First of all - it's actions of Russia and Russia alone.
Second, I think this comment shows zero understanding of the war in Afganistan, because otherwise this comparison would never be made. Tldr: Agfanistan took so long and had such abysmal results because most Afgans didn't actually care about the Taliban, or western democracy, or even Afganistan as a country at all. The presence of western militaries was tolerated at best, despised at worst. Also there are only a handful of cases in modern history where fighting against militia on their own territory has been successful - so in a way what happened in Afganistan isn't surprising(hindsight, eh?).
Ukraine is listerally nothing like this. Ukraine and Ukrainians are fighting a foreign aggressor who is trying to take its land and kill its people by military force - and they have every right to defend themselves.
With the way the war is going, it's (I hope) likely that Russia will be pushed back and out of Ukraine. If that happens, the West will help them rebuild and they will be admitted to EU and maybe even NATO(I'm not so sure about that last one, but we'll see). There is literally no possibility of Afganistan scenario here.