There was never a chance that Russia would lose this war with a country right on its border. Ukraine was destroyed for nothing (other than advancing US interests by driving a wedge between Europe and Russia).
Russia lacks the manpower and military strength to occupy Ukraine indefinitely, while any compliant puppet government they install or favor in Ukraine will be overthrown. To use a term from Soviet military analysis, the long term "correlation of forces" is strongly against Russian control of Ukraine no matter Putin's fantastical thinking to the contrary.
Putin of course will one day pass from the scene and a post-Putin government will have to recognize and accept that even if Ukraine is defeated, they cannot be subjugated indefinitely, at least not at a bearable cost. In that sense, even if Ukraine's resistance today fails, it is nevertheless a hard and bloody down payment toward Ukraine's freedom from Russian control, whether in the current war or in a future struggle.