Do you help the AI when he is at war? Perhaps the AI think the player is stupid too for not helping the way they want. Perhaps it's smart of them to keep some home defence when Castile is the enemy?
Sometimes it's necessary. Jumping into a MP game late, I decided to pick the only nation in India/SEA that didn't have ADM 4 yet: Kachar. They were 3 7 7 and allied only to 3PM Nepal and OPM Koch with a large Bengal (hindu) next to them that was domineering. Using those allies I beat Arakan + ally Malwa, vassaling the latter despite it being larger + more advanced + full annex on Arakan (this caused a coalition lol). I allied Vijay, and a bit before I could westernize I got CTA by Vijay...Bengal + Bahmanis attacking them with more forces than them + me combined.
I was going to westernize soon, and Vijay was my only ally. I could abandon them and risk it, but be defenseless, join the war and do nothing (but risk getting attacked by Bengal anyway), or help. I helped, dragging vassal Malwa units around. The result was a stack wiped Bengal and a shattered + mass nation release Bahmanis. Because it's stupid to count on the AI to reinforce you, I instead ducked around and reinforced the AI, then chased for the stack wipe. What did I get out of that war? Minimal, other than some AT and nobody who could possibly beat me during westernization.
I'll do the same thing for AI allies (with the occasional early separate peace for stuff

) pretty frequently, as you can farm AT + make gains on it and if you want to keep that ally, actually killing enemy troops with ally > letting them siege you or fighting them alone.
The really bad thing about the AI in wars is that the "attach armies" checkbox is filth in terms of consistency, even for vassals. I've had situations like playing as Benin where my vassal Oyo would ignore the "attach unit" check box on both of my stacks and move a 2 stack into the natives, obviously getting stackwiped. WTH is that nonsense. Attach doesn't mean "suicide into natives". It actually means attach. AI allies I can see sometimes choosing to do their own thing if they weight it as higher priority than attaching, but vassals should not ignore attach orders to move into dangerous areas or flagrantly commit suicide.