If Russia actually loses I'd expect someone behind the scenes would forcibly "retire" Putin. The new leader could then use Putin as a scapegoat, pull back, and negotiate for lifting of (at least some) sanctions, since they were implemented in response to the actual invasion.
If Putin persists...