You're right.
And the military in movies used to be depicted as inflexible, stubborn, paranoid, incompetent, and usually either "the bad guys" or authorities that impeded the progress of the main characters. (With exceptions; I'm not forgetting about Top Gun).
Then there was a sudden switch, with the military shown with cool gadgets, airplanes, tech, heroics, and generally being glorified. The transition must have happened before the first Transformers, but it was in full swing by then.
Were one of a conspiratorial mind, one would guess massive amounts of money were spent in changing this image.
Just rewatched Buffalo Soldiers with Joaquin Phoenix. Really don't think that movie could be made today.
No conspiracy necessary. The CIA bought the rights to the 1954 film Animal Farm, modified the ending to fit propagandist ends, and it went undiscovered for four decades. The original Top Gun was intended to recover the image of the US Navy after the Vietnam War. Etc etc etc.
https://en.wikipedia.org/wiki/Military%E2%80%93entertainment...