The AI frequently allies outside its religion and culture group, I've had DOWs on iberian tribes result in being at war with Armenia and the Seleucids due to alliance chains stretching the length of the game.
I have a somewhat different impression, since countries mostly ally with neighbours and countries with similar culture, religion and/or government in the games I have played.
This isn't just a modder's problem, vanilla pretty much guarantees that everyone goes to war with everyone since there's so few countries. There's no reason not to limit call to arms to second degree of separation and it prevents some absurd situations.
If it was guaranteed, I would have experienced world wars as well, which I have not, so I would suggest fiddling with the algorithms the AI uses to decided whether to go to war or not instead of setting an artificial barrier for when a call to arms can be made. It should be a decision based on potential threat and gain, not "we can not join this war because we are only allies of the belligerent's allies". Besides; even if you put that barrier in place, there is no guarantee that the AI will refrain from DOWing outright if it senses weakness just like a human player would, nor should there be.