I am reminded of the battle at Helm's Deep from The Lord of the Rings. There are only two other cinematic scenes that come close: the gun battle in downtown Los Angeles in Heat and the taking of the beaches in Saving Private Ryan. Helm's Deep is probably one of the greatest war scenes in all of movie-making history.
Backs against the wall, Théoden's forces were faced with an existential threat of wave after wave of never-ending combatants who laid siege to the wall.
The Deeping Wall protects the Deep behind the Keep, this is the only escape for the Defenders.
Sauron knew that if the wall was breached, then his invading forces could take the Hornburg. Better, then, would be to keep one's main focus on the wall.
The tactical importance of walls should seem obvious. Even Sun Tzu wrote about the exhaustion of trying to overcome walls:
Thus the highest form of generalship is to balk the enemy's plans; the next best is to prevent the junction of the enemy's forces; the next in order is to attack the enemy's army in the field; and the worst policy of all is to besiege walled cities.
They should be avoided at all cost.
And here again:
The rule is, not to besiege walled cities if it can possibly be avoided. The preparation of mantlets, movable shelters, and various implements of war, will take up three whole months; and the piling up of mounds over against the walls will take three months more.
Laying siege to walled cities is costly. And while natural barriers like rivers, cliffs, and mountains are good, well constructed ramparts are nearly impossible to defeat.