Of course “sneak over to the enemy village at night, quietly kill/rape anyone you see, steal things that aren’t nailed down, and sneak away before the village wakes up” has been a pretty common form of “warfare” since before human beings were human beings.
But the problem comes when all the men in the enemy village get their weapons together and march over to your village. What are you gonna do now? Run away and harass them with guerrilla tactics? You could do that, but that means they’re in your base killing your dudes. You can’t run away from your fields and houses and women and animals and stored food and goods and let the enemy villagers do what they like. They’ll burn your fields, burn your houses, rape and/or enslave your women, capture your animals, and carry away or destroy your food and goods.
Well, you’ve run away and suffered no losses, except now you come back and your village is a smoking ruin, and the only sexy times you’re going to have from now on are with the few beardless youths among the warriors.
The cruel and unfair bit is for attackers. The stand up and fight bit is for defenders. And as was mentioned earlier, if you have to fight, if there are 100 guys from your village and 100 guys from their village, if your guys all stay together in a pack, and their guys are all spread out at random, you can attack his guys with local superior numbers, even if they actually have more men.
Concentrating your forces is a time-tested winning strategy. If you double the number of guys you put on a 100 foot battle line, then your guys fight at a two to one advantage. And this is how Roman legions could routinely slaughter barbarian hordes that vastly outnumbered them. The side that sticks together shoulder to shoulder and laughs at danger wins the battle. The guys that are reasonable and run away lose the battle.
And now consider what happens if your side runs away, and the enemy forces have horses. Horses run faster than people. And this means groups of mounted or chariot troops can ride up and slaughter the routing army piecemeal.
And this is where the intense centuries-long emphasis of the bloody-minded “warrior’s code” comes from. Why do warriors laugh at danger? Because running away is dangerous. A warrior always sticks with his buddies, because being alone is suicide. An army where you trust the guy to your left and the guy to your right with your life, knowing they do the same to you, can easily crush and destroy an army where you don’t give a shit about the guys next to you. And of course the warrior’s code with it’s emphasis on personal bravery and disregard of danger means that your buddies have to SEE you being brave and disregarding danger, or it doesn’t count. And so you have elaborate machismo and self-destructive shows of manliness, all to prove what a bad-ass you are.
But what choice do you have? Be a coward? Cowards live to fight another day. Except the side that ran away lost, and their homes and families were now exposed to the mercy of the winning side. Even if you’re still alive, what’s the point if you come home to a burned house, destroyed crops, no food, your wife carried into captivity, and your children impaled on spikes?
What destroyed this way of fighting was accurate artillery, and accurate rifles. Formations of troops could no longer stand together in the open, they’d get blasted apart by cannon fire, or picked to death by accurate rifle fire. By the time of the American civil war this was obvious. But not that until the invention of reliable breech-loaders it was next to impossible to reload a firearm unless you were standing up. The invention of breech-loading rifles using metallic cartridges meant soldiers could reload their rifle while flat on their bellies. And of course machine guns and barbed wire just intensified the problem.
Of course the other big problem is command and control. How do the leaders tell their troops to march over to this spot, and fight here, or run there, or retreat, or fortify? By yelling “Follow me!” and charging is one way. Fighting in formation is a way of effectively controlling your troops. How do you get hundreds or thousand of guys to fight together? A hundred guys who fight together as a group can literally massacre thousands of guys who don’t know how to work together, even if the thousands of guys are individually superior fighters.
The reason guerrilla tactics work against Americans in Iraq and Afghanistan and Vietnam is that they work against the stated purpose of the Americans being there in the first place. If we had invaded Iraq to kill all the men, rape all the women, enslave all the children, burn all the buildings, and take all the oil, guerrilla tactics would have been worthless. But we were trying to set up some sort of allied state there. So we didn’t want to burn down the villages, we wanted happy prosperous allied villages. But what happens when you’ve got a village that’s ostensibly allied, yet a couple guys from the village sneak out at night and shoot at American soldiers? Destroy everything? How’s that going to accomplish your supposed war aims? It’s a lot easier to destroy than to build. And note that while Iraqi guerrillas had quite a bit of success in Iraq, there weren’t very many of them sneaking into America to shoot at Americans over here.