D&D 5e and its cousins probably need to restore the Morale Check.
Old-School Morale
In old D&D monsters and opposing NPCs had a Morale score, which was a number between 2 and 12. The Referee would roll 2d6 and compare it to Morale to determine whether the monster or NPC would stay and fight or break and run. I’ve reproduced an example below.
If I ever DM again, for D&D 5e or any similar game, I may introduce a rule like the one below. This will help monsters act like real creatures, or at least prevent them from becoming XP farms.
Old-School Essentials Morale
This is the rule from the Old School Essentials SRD:
Morale Rating
Monsters are rated for morale with a number from 2–12. This represents their courage in battle. Higher morale scores indicate more fearless monsters.
A score of 2: Means the monster will not fight. No morale checks should be made.
A score of 12: Means the monster fights to the death, never checking morale.
Morale Checks
The referee rolls 2d6 and compares the result against the monster’s morale score:
Higher than morale score: The monster will surrender or attempt to flee.
Equal to or lower than morale score: The monster will continue to fight.
Two successes: If a monster makes two successful morale checks in an encounter, it will fight until killed, with no further checks necessary.
When to Check Morale
Monsters make morale checks (rolled by the referee) in two circumstances:
First death on side: The first time one of their number is killed in battle.
Side half incapacitated: When half the monsters are incapacitated (slain, paralysed, etc).
Situational Adjustments
The referee may apply morale modifiers from -2 to +2, based on the situation. For example, the side losing a battle might suffer a -1 morale penalty, while the side winning may gain a +1 bonus.
Scores of 2 or 12: Adjustments are never applied to monsters with a morale of 2 or 12.