Well, if a unit is withdrawing, it means that it would've been killed if it couldn't withdraw. So it's not really an issue.
What frustrated me though was one mod where units had "morale" and my city was attacked and in spite of the fact that my Warrior was winning against a Barbarian Warrior, they fled the city and the barbs just moved in and took it, which then they were too tough to dislodge because on top of the city defense bonus, the warrior also got promoted from its "victory" over me.
The problem with defensive retreat is in choosing which tile the unit should flee to... there are a number of things to take into account here:
1) Does the unit have defensive bonuses on particular terrain/features? And if yes, do we want to move it to a tile with those characteristics?
2) Is the tile immediately adjacent to an enemy unit? If yes, we probably don't want to move it there.
3) Is there an adjacent tile with a stack of friendly units, do we want to move it there? Probably yes.
4) And what about the defensive bonuses of each possible tile? Forests, hills, forts, etc.?
5) What are the possible range of tiles to examine? If the unit is being attacked from North, should it be open to retreat E, W, SE, SW, and S? Or just SE, SW, or S? This is important because if the best plot choice happens to be due east, the unit will be moving to a tile that might be more precarious. And if the limited range of tiles are blocked by enemy units, sea tiles, etc. should the defending unit be able to move into one of the adjacent tiles outside the normal range?
6) Should the number of available tiles affect the withdrawal probability? If the unit has virtually any one of the five tiles to move to, should it get a higher withdrawal probability than if it only had one or two options?
EDIT: Also, if there are multiple units on the defense unit's tile, you might want a simple disengagement because why would the one engaged defensive unit simply bolt and run to a tile by itself instead of remaining within its stack.
Just some thoughts... cheers!