I'll call them AI #1 and #2. From the way you have explained the situation, you were "cool" with #1 and allied to #2. #1 and #2 were also allied to each other. When #1 attacked you, #2 would have been left with the choice of breaking the alliance with you (by refusing to help) or breaking the alliance with #1 (by helping and attacking them). In this fairly rare situation, they are not asked to do either - if the player is in the same situation as #2, you will not even get the pop up box asking if you want to help or not, your neutrality is just assumed.
As far as I can tell, this was intentionally included to prevent the player from being able to break AI alliances at will. The AI can't set up this sort of situation on purpose, so allowing the player to do so would simply be an exploit.