Tank commanders don't just stand on top of their tank because it looks awesome.
They do it so they can get a good look around. Inside a tank the commander is blind and deaf. They're inside a very loud metal box looking out through little slits and narrow scopes. Paradoxically its safer for a tank commander to be exposed outside the armor looking for threats than to be blind and deaf under armor.
This works in open terrain where the commander can see threats coming and have time to react. Infantry is less of a threat in open terrain. There's less concealment, and infantry anti-tank weapons are short ranged; about 300 meters or much less at that time.
To make efficient use of their weight tanks have most of their armor in the front. Less on the sides. And little in the top, bottom, and rear. Ideally a tank is always facing its enemy with its thickest armor forward. Enemies which get to the flanks and rear of a tank can more easily get through the armor. There's a famous example of a US army scout car killing a King Tiger with a 37 mm peashooter because it was able to get behind it and fire into the thin rear armor.
Blind, deaf, and vulnerable in the flanks and rear, a city is a nightmare for an unsupported tank. In a city a tank is a loud, large target. Visibility is limited. Ranges are short. There's lots of concealment for scouts, snipers, and anti-tank weapons who all know you're coming. There's lots of rooftops an enemy can drop a grenade or fire a rocket from. An a city a tank commander outside their cupola risks getting shot by a sniper. In a city, suddenly one man with a $500 RPG-7 can sneak up on and destroy your $300,000 (in 1970) tank.
In a city, a tank needs the infantry to be their eyes and ears. Ideally the infantry should be leading and covering the flanks, and the tanks should be following close behind ready to provide fire support. If the infantry runs into a tight spot they can call the tank forward. The infantry provides cover and suppressing fire for the tank's flanks and rear. The tank advances on the strong-point and suppresses it.
However it doesn't always work out that way. Sometimes the tanks don't support the infantry close enough. Sometimes there's poor communication between the infantry and the tanks. Infantry need specialized training to work effectively with tanks to know their strengths and weaknesses. Military History not Visualized has a good video on how German Armored Infantry were trained to coordinate with tanks.
The the infantry Full Metal Jacket are not armored infantry. They don't have special training to work with tanks and probably don't appreciate a tank's weaknesses. To them it seems absurd they have to go in before tank with the armor and the huge gun. In that respect the filmmaker was using it to demonstrate the absurdity of war, but the situation is real.