Do you really think that the end of the Ukraine War will lead to the dismemberment and surrender of Russia - massive nuclear power?
Afghanistan did to the much larger Soviet Union.
The Soviet Military was four times the size of the current Russian Military. They Warsaw Pact countries that were on their side then, are now in NATO, and are their fiercest opponents (after the Ukrainians).
Afghanistan and the Ukraine are fairly similar in land area and total population, but the Ukrainians are dramatically better educated and technically competent, as well as exceptionally knowledgeable about Russian language, tactics, capabilities and vulnerabilities. International military support to the Ukrainian forces dwarfs what was given to the Afghans fighting the Soviets.
The Soviets lost about 15,000 KIA in a decade in Afghanistan, but have already lost several times as many in 2022 in the Ukraine, with much higher equipment losses as well.
Now that Russia’s relative Artillery advantage has declined significantly, its fleets of operational tanks and close air support aircraft are well over halfway attritted, and the bulk of its professional Army combat troops increasingly replaced by poorly trained recently mobilized; Russian casualty rates are approaching as much as the whole Afghan War, each month in the Ukraine.
They buffered the social impact by using higher percentages of ethnic minorities, like Buryats and Chechans, and leaning heavily on conscripts from within occupied Ukrainian territory (LDR/DPR), as well as lots of prisoners and mercenaries. But those options are now running their course. No Divisions arrived from Syria. No 100,000 troops came from North Korea.
The next wave of mobilization is going to start digging deeper into white ethnic Russians in Moscow and St. Petersburg. The old Soviet stockpiles are being burned through rapidly - many times faster than production can replenish. Orders of magnitude more rapidly. At these rates, this year (2023) will see them exhausted largely across the board - cruise missiles, Artillery shells and tubes, main battle tanks, close air support aircraft, etc..
Funny, Afghanistan did to the much larger United States and NATO under Biden who is the idiot leading the Ukraine War.
Also you might want to consider that there is a vast distance in mentality between fighting a war abroad and fighting on your own soil.