It baffles me...honestly, completely...how resistant players can be to retreating.
I have noticed that, yes.
Have you noticed that it's typically fairly hard to retreat successfully in D&D, and kinda always has been?
I mean, just check the movement rates & modes of the monsters in the encounter, vs those of the PCs. Chances are there's at least one slower PC, too. If the monsters aren't all faster than the PCs, they're at least likely to leave one slower PC to die. Not cool. Also, by the time they realize they're not going to win this one, someone may have already dropped, so there's some emergency healing to do, or you have to pick him up.
Then, specific to 5e, there's no way to re-arrange the cyclical initiative order, so if the enemy isn't all going in a group, and the retreat doesn't doesn't start with the PC that goes right after the last enemy, there will, again, be someone left behind to be mobbed.
You'd need to provide a robust - or downright arbitrary - -sub-system, a player-side system that they know about and feel confident in, if you want to start enabling the better part of valor, that way.
It's not like pursuit & evasion sub-systems have never existed, 1e had one, it just didn't often lead to the party getting away, and 5e has one that's not particularly better, AFAICT. 4e had Skill Challenges, but the way they were presented the DM kinda had to plan on one in advance, so you'd more likely have a too-deadly encounter couched as a Skill Challenge to
avoid the encounter, up-front, instead.
...
Also, D&D's hit point attrition model lacks death spiral effects, so you actually can turn around an encounter that's going very badly even as you hang on by a few hps - in 5e, for instance, if you can keep the baddies playing whack-a-mole with your front-liners long enough to drop a few of 'em and turn the tide.