The AI can't actually damage you (aside from minor damage via bombing) or take anything away from you without winning the war so what does it matter if he wastes his time rampaging around on your back line capturing things he will never be able to hold?
Since I haven't been in a war yet, I'm curious about this. Is the AI literally unable to occupy your systems unless they win the war, or is the AI just too dumb to do it in practice? I've certainly seen the AI build plenty of troop transports, which I assumed was for this purpose.
It's both, really.
You occupy a system by attacking the outpost or starbase in the middle. They can't be destroyed, however - they are just disabled and the winner captures them and repairs them for free. You lose the income from the system, but the attacker does not gain it (afaik). The AI can't delete your starbases or change the modules or anything like that either. Planets are similar. Once they are captured they are occupied, but the AI can't purge your pops or destroy your buildings or anything like that.
To keep the systems forever they have to have a claim on them AND they have to be controlling them when the war ends. For planets, they have to control ALL the planets AND the starbase to keep them.
The system is very forgiving about when a peace happens. The AI can't force you to make peace unless you are at 100% war exhaustion and a certain amount of time has passed, but the AI will accept white peace you offer very easily. So you have almost total control over when the war ends, and you should never have to accept peace when the AI controls important systems unless things have gone really, really bad.
So as long as you follow the AI recapturing systems, you lose nothing and there's no cost since everything is repaired for free. Outposts are very weak so a tiny fleet can (re)capture them, but the AI is too dumb to realize that and will waste time capturing them with his main fleet. The AI will also waste huge amounts of time bombing planets, letting you either recapture more of your territory or capture some of his while his fleet is occupied. As long as you use your small "recapture" fleet to take the outpost over after his fleet leaves you don't even have to recapture your planet, since he will be forced to give it back intact when the war ends.
TL;DR: the AI does not understand how the current war system works and it does not wage war correctly. The player also has too much control over when a war ends (AI too willing to accept white peace) so you never have to give up anything important unless you've really, really messed up somehow.
Edit: white peace = status quo peace. It's only actually called white peace if no systems change hands.