From further intensive testing the past hours, I´d say there´s more involved, if one looks carefully at the environment, the routing takes place. I´d some really sticky entrenchment defenders, without making them uber troopers in the editor beforehand. What appeared helping a lot, is to use rear slope defenses (or within woods, cities...), to disallow too many enemies getting LOS/LOF on single defending units. At least that counts for human controled units and lots of micromanaging.
I´ve yet to test with AI units, although I have some doubts that it can handle these the way I just mentioned.
Could also be, that more retreating and routing is triggered, when an otherwise good shape unit gets to a point, when it starts to request emergency resupply. I´d entrenchment defenders obviously stick longer, if I raised initial ammo stocks to about 200% (a well prepared defense would have extra supply at hand, ammo in particular).
Another point with "routing to wrong places", could be an irregular frontline (or none at all), i.e large open flanks, larger map parts which are void of enemies and such. The more a front is "closed" towards the enemy main lines, the less likely a routing unit moves to wrong places.
Would be nice, if one could "paint" map parts initially as "friendly" and "enemy" territory, which gets updated during a battle, in order to feed units with some "frontline awareness".
Btw, do routing units take "lost contact" counters into consideration, or just currently visible threats?
Well, that´s all just from latest "observations". No idea, if all that said makes any sense...