According to the actor who played Shane, it was intended to be a funny skit (e.g. rather than a creepy man just explaining why he's dating a child). Notably, it was added after the script was finalised, presumably to 'punch-up' the comedy in the scene.
“I was 21 years of age, making this huge franchise film, and doing what I was told, because that’s kind of what you do when you get on one of those films,” Reynor explained, noting the joke wasn’t in the script initially.
“When you look at the culture of it now, especially given the advent of the #MeToo era, yeah, it’s definitely a problematic joke, but I’m not the writer of the film.”
Transformers: Age of Extinction star Jack Reynor revisits that awkward age-gap joke: 'It’s definitely problematic'
The film's producer says that it was intended as ribald humour (about underage sex) and you should just get over it.
MTV: There's also a lengthy scene where you have a joke about Romeo and Juliet laws in Texas, and multiple reviews brought up concerns about that, particularly the content of that scene. In a movie that is based on a toy line, you’re going to get kids coming in, families coming in, was there any discussion about that scene in particular maybe crossing the line?
Bonaventura: Our world has gotten so over concerned about things, that’s my reaction to that. I find that scene funny and I don’t think there’s anything in it that’s so ribald or strange that anybody should have concern.
Look I respect people’s rights to feel that way, but I don’t know, I think it’s a funny scene and it’s intentionally funny. And it’s a real thing at the same time, which is probably what makes it funny you know? It probably makes people feel uncomfortable because it’s something that happens in the real world and we’re just giving it a moment.
I don’t know, I think people take things too seriously. The whole scene [shows] how people look at our world and have a lot of respect. Come on you guys have a little sense of humor.
'TRANSFORMERS' PRODUCER ANSWERS CRITICS BIGGEST PROBLEMS WITH 'AGE OF EXTINCTION'