Yeah but that's not going to do anything to keep them from winning the war. All it does is slightly irritate them after the fact. Everything is after the fact which is the problem. After the fact, you have already won the war and the losers have 0 chance of reversing things.
There was an old mechanic in a game from the early 80s that handled this differently.
If you spent too long fighting a war (the game was turn based, so it checked every turn I think), levies would just go home. The peasant levy was usually the first to go, but I remember my nobles also sometimes going home.
I suppose you could set up a game mechanic where vassals have the option to disband their liege levy when certain criteria are met. That way, the opinion penalty would have a real and immediate effect. It could even interact with the council in some way.
"We need to extend the war for two more years to put the final nail in the Welsh coffin."
"Bad news, your kingliness. Your top five vassals took their levies and went home. They're tired of the lack of booty."
"But I let them have camp followers!"
"That's not what they meant, your gracelessness. That want loot from defeated armies and holdings."
"Fine, we don't need them."
"May I suggest we hire mercenaries? There is a 15,000 HRE stack heading our way."
"15,000? To Hell with mercenaries. Fire up the Bat Signal. Oh, and declare the top 5 vassals traitors for leaving."
"No can do. Christian Bale is taking other roles, so the Batman is unavailable. And your council prohibits you from declaring vassals traitor when you keep their levies up too long."