The problem was that Communist government lacked legitimacy to many of the Afghani people. It took steps to promote state atheism, botched its economic policies (despite intending to help poor peasants, but when do Communists not botch the economy?), and imposed a police state that was harsher than before.
It is these conditions that provoked resistance. Islamism was simply the form that the resistance took. It took that because 1) Islam clearly separated the rebels from the regime, and 2) Islam enabled the rebels to attract support from outsiders, such as their coreligionists in Pakistan and Saudi Arabia. Furthermore, as India was a de facto "ally" of the Soviet Union, any Communist government would be considered to be dangerous to the Pakistani government which has always attempted to control/dominate Afghanistan.
Even if the communist government decimates the rebels, I still see an ongoing civil war albeit one of lower intensity. Afghanistan's mountainous terrain makes it very easy for people to hide. And there will be continued foreign support (even if the US decides not to sponsor it anymore). The rebels slowly rebuild, and then the government is threatened again. The Soviets are going to cut their losses sooner or later. They just don't have the money in the 1990s to keep supplying the Kabul regime. Its going to be left to their own devices and internal revenue against a force receiving support from Pakistan and the Gulf oil states.
The question is whether the communist government can 1) reverse all its policies that are provoking people into rebellion, and 2) can build legitimacy if it does so. I have very strong doubts that it can do so.
However, there is always the possibility that the government could pull it off. If the rebels are heavily defeated, they may have several years of breathing space. If they negotiate with the other countries who are sponsoring the rebels, they might come to some sort of agreement which stops outside aide, includes some rebels in a coalition government, and changes many of their policies. It would be very hard to call it a Communist government then, and it's highly unlikely.
If it doesn't do any reforms, find some way to bolster their legitimacy, and doesn't stop the other regional players from supporting the rebels, it's just ongoing civil war and turmoil that erodes the government's ability to control the longer it goes on.