No two wars are the same. Korea and Vietnam tell that story succinctly.Afghanistan, Iraq... it worked well. Both Russia and the US found out the hard way that tucking their tail and leaving makes sense rather than throw more resources into a losing situation.
I doubt Putin will ever be able to peacefully keep the territory. He can make the war he started go away, just find some face-saving pretense and give the order.
Relative to Afghanistan and Iraq, Ukrainians are more pragmatic and will choose peace over protracted conflict. Russia is fighting next door on former Soviet territory. They really didn't care much about Afghanistan.
You are making some kind of overly idealistic almost suicidal argument. The internet is full of shills for the Ukrainian and Russian sides. It's just been that way since the war started.
Incidentally, Putin had been able to keep Ukrainian territory peacefully prior to the latest invasion.