It might be plausible that entering an alliance wont immediately put you at war with allies enemies, but at least you should get some relationship penalty with them. Something like "You are an ally of my enemy" -50.
Something like "You are an ally of my ally" +50 also might make sense, but I haven't seen AI allying AI.
And "You are at war with my enemy" +25.
+ diplomatic penalties when intercepting colony ship or colonizing in a nearby stars system and even more so if in the same system (can be negated if in alliance though)
It also seems that the AI will attack the player in a battle involving 3 parties if its ships are closer even when in war with the 3rd party and being super friendly +120 rep with the player