When I unload mechanized infantry (or from unload on contact SOP) from their rides they sometimes get detached (sometimes they can't even get reattached) and also just stand there doing nothing.
I think they should at least inherit the same missions as the formation they are in when they unload. It's really annoying that I have to individually give them missions (which has 1+ minute delay) or stop the entire formation and get another delay.
I don't know why your infantry unit becomes detached when unloaded, because I think it should not, but if the transport is destroyed then the infantry unit is detached permanently.
You can use formation->regroup to keep the unloaded infantry moving. Perhaps select formation->free first so they won't start to reorganize.