I am winning my 1-on-1 war with Alex when he with one city left vassals to megasuperpower Suleiman who declares on me. Now I am toast and probably wont win my first ever victory on Emperor. :-( :-(
But I seem to remember other games where the same kind of situation ended up with a forced peace treaty in the ongoing war rather than a DOW. Is there some randomness to this whether war is declared or not, or does it depend on whether Suleiman is at war already with Alex or not?
Two types of vassals:
Peace (or willing) vassal: the small AI "trades" vassal status to the big AI freely, who assumes the war status of their vassal at the time. As such it can be used as a sort of bribe to pull the big guy into war, and happens a lot when beating on AIs until the breaking point. There are no size requirements, though vassals have to like their master (generally, check Know Your Enemy thread for specific thresholds) and they will tend to only do it when weaker in soldier power by a good margin.
The easiest way to avoid it as a possibility is to eliminate prospective candidates from taking the small AI in, through the various methods already discussed upthread like putting them in other wars, even if it's against the same small AI you are attacking, or begging/demanding for enforced peace treaties. Also because the vassal more or less has to like the potential master, you can foster animosity to block peace vassals too, though it's not as surefire as just getting any potential master into a war as AIs will (almost) never declare another while already at war outside of specific tomfoolery with the AP or if they were already plotting over a refused demand.
Capitulates (unwilling): small AI knuckles under to an aggressor who gains necessary war success (net of +40, gotten through killing units and taking cities) against them and who meets the size requirements (>= 50% land or pop). Not sure the size requirement applies to AIs with certainty, but you can absolutely cap an AI yourself simply by having the pop and war success alone even if you can't get the land size. The capitulate immediately assumes the war status of their master.
Summary is:
If you are both at War with Alex and the war ends with him vassaled and forced peace, it's because Alex capitulated to him instead of you. Alex assumes Suleiman's war status, which is NO WAR with you, and thus you are forced into peace with Alex and nothing else happens, no DoW from Suleiman.. This can be jarring sometimes as the other attacking AI can do a lot less work that you but the punching bag will still rather vassal to the other guy than you. To which the learned lesson is to generally take vassals when you can before this becomes the outcome.
If Suleiman is NOT at war with Alex, Alex caps to him and Suleiman DoWs on you, it's because Alex "peace" vassaled to Suleiman, who took it as a bribe to attack you.
The biggest punch in the face is that Alex can just leave the arrangement more or less at will, even while the war is going on (though it is
considerably less likely while you are still at war with him) and you're still stuck with Suleiman coming for you.