They gain ducats and prestige from it so why not from their pov
Problem here is that often, they can't. There are many situations in which the AI secures a solid win, then completely squanders it because the AI logic goes "hey, I'm winning, might as well win some more!" instead of realizing "oh man, I got to 72% warscore by a godsent miracle and should take my win before the Ottomans regroup and smash me into the dirt whence I came!"
Programming AI is difficult, of course, but I feel like a dev weight for small nations might help here. Something in the vein of "has more than 50% warscore against target with 2x dev", for example, would let the AI better leverage miracle wins. Inversely, "would only gain minor concessions from continuing" would help big nations peace out small ones before 100% WS is achieved.
For peer or near-peer conflicts, it's harder, though. But those are the wars I feel
should drag on, anyways.