What happens if the USSR was still fighting in Afghanistan when they collapsed ?

Hey everyone, first time poster and long time lurker here.

The Soviets got lucky in hindsight that they high tailed out of Afghanistan in 1989, 2 years before the eventual collapse of the country.

What kind of chaos would ensue if the Soviets collapsed in 1989 or they stayed in Afghanistan until 1991? It would be very interesting to see what would happen to the ex Soviet non ethnic Russian soldiers now not being part of the same army anymore, while the country is still fighting the Mujahideen.
 
Top