I actually think a better movie comparison to Transformers would be Fast and Furious 7. I'm not a fan of the F&F franchise but hubby dragged me along to the latest one and I was impressed with the balance between the action sequences and the flow of the storyline. With actors like Rock and Vin Diesel you don't get a lot of "expression" and yet somehow the story and the way it flowed did bring out the best of these guys while still providing fast cars, lots of explosions, action and even the odd bit of sexualisation. I was pleasantly surprised by the film actually having more to it than I expected.
I sat there thinking - why couldn't TF4 be like this? Why couldn't they have writers bring enough substance to the story... to the characters... to make you care like this movie does? Let's face it - there are a lot of scenes in F&F that could translate directly into a Transformers storyline and even some of the vehicles matched up with past and present TF characters.

As for Avengers. It's directed by Joss Whedon... who really does live for his characters... possibly a bit TOO much in the new film (did anyone else think they overdid the Hawkeye scenes?) but he makes a point of understanding the source material, the personalities, strengths and weaknesses and building on them (and he does this with every film/TV show he directs). You can tell he actually put thought into and cares about the storytelling aspect as well as the CGI and explosions. I always wonder what his take would be on a Transformers film as I think it would be a vastly different vision to that of Michael Bay.

In terms of Imax, visually Transformers 4 was far superior to Avengers:Age of Ultron but the storyline in Ultron despite its faults is still far more robust, in depth and entertaining than Transformers. As TF4 proved - you can have amazing Imax scenes, good CGI and incredible surround sound but that adds up to nothing if you don't have a story that engages your audience and treats them like sentient beings.

I think the blame for the storyline does lie with the writers, but ALSO with Bay who directs the story, the writers and the vision. I don't think he takes his main characters - his bots - seriously enough. That's really apparent when you don't even bring the actor behind the main character, Optimus Prime (ie Peter Cullen) to the world premiere despite using that character (Optimus) as the limelight piece for the media at the same event, yet you bring the actors who had no real purpose to the storyline other than to add rubbish romeo and juliet scenes (yeah - I'm talking about the waste of space who played Shane). I think Bay focusses too much on his real life actors and forgets about the real stars and the real story - his Autobots, Decepticons, and whatever you would consider those KSI bots to be. If he was taking these films seriously we would see an underlying storyline development of (as an example) Optimus Prime from Autobot leader through the struggles and trials of being on Earth, displaced and struggling with a new norm/leading his team/learning from hardship to ultimately his purpose/fate and inevitable sacrifice to save the universe and fulfil his destiny. Optimus hasn't had any consistent development or evolution through the movies in my opinion. He doesn't grow or learn or even really emote. We don't see the ramifications of his mentors betrayal on him in DoTM or AoE. We don't see the heartache and conflict of loosing arguably his best friend (Ironhide) or most trusted comrade (Ratchet) - just anger and vengeance (which doesn't fit with who Optimus is in my opinion). We don't even see him inspiring Bumblebee or any of his team. Autobots fight in front of him and he does nothing. NOTHING! A leader like Prime is supposed to be would not let that go unresolved. You can argue similar problems with all the characters (don't get me started about poor Galvatron!).
Even with the best CGI and best voice talent in the world, without a purposeful story to emote, your characters are going to remain 2 dimensional and I think that's the current problem the Transformers movies face.