There is a middle ground which is kind of happening. Ukraine doesn't get all its territory back as it would be too costly in lives. It doesn't join NATO as that was never that practical.
However it builds up its military with the aid of partner countries sufficiently to stop Russia.
That's my bet - it gets frozen with some territory lost but with Ukraine able to defend itself a bit like USSR v Finland. I daresay it could still go like USSR v Afganistan too.