Currently I am playing as the moors and I've taken all of Iberia and I am pushing the English out of France. I was once at war with the French but now have an alliance. I've had an alliance with them for 30 years and they didn't attack. They had two provinces left which were Ile de France and the provence to the right of toulouse (forgot the name). I always kept a big enough army to defend right next to their border in case they tried to pull anything. They didn't even dare invade me. The English sailed in reinforcements and two of my armies got bogged down in fighting near Caen and I needed to send my army on the French border up to support them. 3 turns after I did this the French saw that toulouse was poorly defended and decided to try to besiege the settlement.

I wouldn't call the Campaign AI dumb, rather, opportunistic. You can have a faithful ally but you need to show them you can defend yourself should they try to pull anything. The bigger you become and the smaller your border allies are the more dangeous they are. They may try to take a province or two of yours for their own preservation.