It may be infuriating, but that certainly doesn't need to be fixed. Think about it.
There they are, the Apulian army joined together with other armies in a common struggle with a common goal... then your army appears on the scene. Do you SERIOUSLY suggest that what should happen in your scenario is that the Apulian allies should take a look at your army, say, this isn't our fight, and move aside to stand by while you slaughter their ally?
You committed a serious mistake and attacked somebody you thought was vulnerable, but who wasn't, because he was engaged in a war together with allies that behaved as allies.
No, fighting those that are marching together is entirely as it should be.
What
is considerably more questionable is the way AI's will happily attach and march around in offensive operations unconnected to the war the joined rather than only sticking with the stack in relevant theatres. It can lead to truly absurd situations and abuse of other countries' doomstacks. Then again, setting up nice rules for handling that, which aren't easily abusable by human players, is rather hard, so on the whole I prefer the current solution...for now... and until somebody comes up with a better one.
