War is the crucible for generals. They have worked their entire careers, demonstrating courage and competence, to reach that level. Those qualities are never more tested than in battle.
Winning every battle is hoped for but not expected. Loss is a natural part of war. But a general who leads the army into a costly and catastrophic loss knows that their leadership position is on the line. Generals who make those kinds of mistakes are fired, both to avoid further losses and to increase the chances of victory.
When the failing general can’t be fired, we do what we can, we hope that other leaders will step in, and hope that the losses can be minimized. The enemy, we know, will not give up.