It is more of an SOP thing. In a world where the enemy is as likely as not to be equipped with short range artillery and/or sleep bombs (things that any soldier in a D&D world would be aware of, unless you presume a far greater rarity of spellcasters and other area attacks than the core 5E books suggest) not clumping up would be standard operating procedure. It's essentially the same reason they taught us in basic to practice "social distancing" -- not every enemy has a grenade or uses landmines, but some are going to and it would be better if you lost fewer soldiers when they were inevitably deployed.
Now, would soldiers still line up in great ranks at "official" battles? Sure. If thousands of soldiers stretch hundreds of yards or more along a battle line ten ranks deep, the overall impact of fireball is reduced. But in the guerrilla combat that is represented by tactical level D&D, any soldier(including orcs; that's what they do) is going to try an minimize the possibility of being the one killed by the fireball or dropped by the sleep spell. And of course, players can and should try and overcome that tendency with strategies and tactics, forcing choke points or doing a little ambushing themselves or whatever. But it isn't a foregone conclusion that humanoid enemies are going to line up to be slaughtered.