Mechs also provide a very powerful psychological tool in warfare. Using mechs has the effect of humanizing the technology, which can have both defensive and offensive benefits. If you can accurately control the appearance of your weapons in relation to the
Uncanny Valley, you can open up an entirely new world of mind games on your enemy.
On the defensive side, a humanoid mech is less likely to be shot at. Believe it or not, most people are actually quite averse to killing another person, and will avoid doing it even in war. In fact, one of the primary methods of training people to kill is to dehumanize their enemy. By giving your opponent a more human-like target, you minimize that dehumanization. A mech puts a face on the enemy, which makes it harder to pull the trigger. For more information on this effect, check out this Cracked article:
The Biggest Star Wars Plot Hole, Explained By Science | Cracked.com , or read On Killing by Dave Grossman.
Having a humanoid mech can also be a powerful tool of inspiration. The powers-that-be in war often try and find important heroes to be the face of the war so that people can feel a more direct connection to the events, and to give them hope. Imagine if that heroic symbol could be the flagship itself. This was one of the over-arching points across the Macross series, where the SDF1 eventually became the center of city.
The same humanizing effect can also be used for intimidation. If you want to maintain a military presence, having the streets patrolled by a fierce and human-like mech may be able to instill fear better than a simple car or truck. And the effect of having a wave of giants swarm over a city would be immensely more fear inducing than a simple fly-by from military jets. IIRC, this technique was discussed in the second book in the Leviathan series.
The bottom line is that the same psychology that makes mechs "cool" can also be used as a tool of warfare. It's certainly an expensive tool to implement, but one that shouldn't be overlooked.