At the moment, ships can only have a single “movement” order active at once. I can see how having multiple potentially contradictory movement orders would be tricky for the AI, but how about being able to specify levels of redundancy?
I.e, if you give both a “Formation” and a “Keep Moving” order, “Formation” has priority, so the ship will attempt to remain in formation with the target…but once the target dies, the order becomes obsolete, and it will default to its next-highest movement order…which is to Keep Moving. Formation and Escort orders obsolete themselves already when the target dies, so this would just default to another movement guideline instead of the Attack Whatever order.
For existing orders, a priority of Formation -> Escort -> Keep Moving would seem to do the trick. Being able to give multiple Escort orders would be neat too, but that might be trickier to implement, I dunno.
Having a system of order obsolescence and progression might open up the door for some neat additional orders, too, like a “Set Course!” order that sends your ship off towards a given point at a selectable speed, and obsoletes when it reaches that point or engages an enemy (at the Attack Whatever range), or a “Follow!” order that acts like a Formation order but obsoletes when the target finishes its first drive order, simulating the “Break and Attack” behavior mentioned a few threads down.
Given how ships default to an Attack order once their Formation or Escort target dies, some of this behavior already seems to be in the game: formalizing it into an order priority system might be simple, and would offer players a lot more freedom in how they set up their fleets.