Those movies keep making money due to the 10 years of marvel movies built up before hand. Most of those 20 movies had great writing and built an interconnected universe that made general audiences go "I wonder what's next". Transformers atm does not have that, with what came before being controversial and still fresh in people's minds. Unlike marvel which has a "must watch to understand the next movie" mentality keeping people invested, Transformers desperately needs good writing, vfx, characters, etc. It has to do a lot more to get the box office numbers needed than marvel films do. Also With marvel's CGI, its a different situation. With most of the stories being about humans and real actors, the story and writing matter way more than the VFX ever will. Meanwhile, with transformers, the VFX are the characters. So more attention has to put on it along side the writing.