It depends on what you mean by "doesn't lose". Consider that they "didn't lose" in Afghanistan, but instead chose to withdraw after expending so many lives and so much money that the USSR was destabilized. Also consider the level of outside support that went to Afghani "freedom fighters" and compare that to what's flowing into Ukraine.
Now look at a map. Most/all the Afghani aid was flowing through the tribal areas of Pakistan. The freedom fighters could flee across the border, but there was very little keeping the Soviet troops from following. Compare that to fleeing across a border to a NATO country, where the penalty for following - or even striking remotely - is the involvement of NATO. NATO forces vastly overmatch the RF.
It's pretty clear Putin is isolated, probably isn't getting an accurate account of the war's progress in Ukraine. But none of this is new information. The man's certainly aware of what Soviet involvement in Afghanistan did to the USSR. He also has a map and can look at what countries border the one he's now invading.
My concern for Ukraine and Ukrainians is simply that it's in the West's interest for this troublesome neighbor to be effectively "taken off the board" - and an ongoing conflict in Ukraine would do that in the medium term. They've tried to incorporate the Russian economy into the European one. It's clear that that hasn't worked (and has really backfired on Germany, although I can see the motivation immediately post-unification).