When you conduct a combat, there’s a sequence you follow. The decision to retreat comes after both sides fire, so you have to conduct at least one round of shots before you can retreat.
Yes, you can end up moving farther than you would normally be allowed to.
The counter there by the Allies would be to move the US/UK/ANZAC DDs and CA to SZs 37/43/35/45. It limits J transports in SZ36 (South China Sea) or SZ33 (Carolines) to attacking Malaya, Borneo and Phillipines on J3. You can take the remaining DEI on J4 but the transports will require protection because the US can fly the 3 bombers to Australia on US3 and the UK planes can also attack.
Simpliest solution to that is to park your fleet in SZ 42 on J2. Just make sure the UK/ANZAC cannot sink it, US isn’t allowed to attack until turn 4 and cannot land planes on Australia until they are at war so they do not matter in this case.