I never said it didn't, but as it stands tanks at least have the advantage of a tank crew - between the commander, driver and the gunner, you have a pretty wide potential field of view at any one time.
The fact that an armored vehicle with an entire unit of infantry attached can -still- end up ambushed by a couple ragheads with RPGs should show just how vulnerable ANY vehicle is though, regardless of the number of eyes and ears it has on hand. The benefits you suggest a mech has over a tank when fighting infantry are minuscule at best and outright detrimental at worst.
I will say this though, I completely agree with what you say about how
I honestly think that would be a mechs primary role in city combat, as their height advantage essentially allows them to really exploit the size difference of certain buildings to shoot at targets one, two or even three streets away. Performing hit and run attacks or ambushes on enemy armor would be child's play when you have legs that can crouch and the ability to peer over buildings.
It wouldn't change the fact that if your turret-hand can shoot them, they can shoot you.
It's like suggesting you take a knife and try to remove a beehive by stabbing the insects inside. If you've got infantry inside a structure, the last thing you want to do is risk an expensive, manned vehicle by having it poke around near potentially-occupied windows. As I said earlier, I feel like you'd have way more success with mounting a gun on a drone and just having that perform the exact same role without the risk of some faggot with a rocket launcher crippling a multi-million dollar vehicle's arm (or, even worse, sneaking up to a window and getting you in the torso or cockpit).
Personally, I feel like the main strength of a mech isn't as a frontline fighter in urban combat. It seems to me the real advantages a mech has over other vehicles is it's ability to change it's overall height and it's extremely high degree of weapon elevation that lets them engage a wide variety of threats.
A mech with an autocannon on one arm and a mortar on the other can act as an artillery, anti-VTOL and anti-tank system at the same time, while providing a great scouting platform thanks to their height.
They can potentially fill a lot of extremely useful area denial roles that currently either require specialized infantrymen or dedicated vehicles to fill. In my mind, they, essentially, have more in common with helicopters than tanks.