That does not preclude a player from moving from a friendly territory, into a second friendly territory, and then into a hostile territory two spaces away does it?
That is exactly what the rules prevent. You must use your full movement to enter a hostile territory (one that contains no friendly units); think of this in the same way that you can’t move ground units before loading onto a transport.
You can move units multiple spaces into a contested territory though, and they would participate in an attack in said contested territory if you made one.