Unit can retreat in the manner. Units must be retreated to a space that was friendly owned at the beginning of the movement phase. The scenario you outlined happens often - where the cut off units retreat through the encirclement back to friendly lines. I can see why you might not like it (until it happens to you
) but, I think allowing it to happen is important.
There were a lot of instances of units breaking out of pockets and making it back to friendly lines - even big corps sized formations - so it is not entirely against historical precedent.