If you were to ask Xi Jinping why the USSR imploded, he would probably give you two reasons. First, Gorbachev was a wimp; he wasn’t willing to use massive amounts of military force against his own people. The CCP didn’t make that mistake. Second, the Soviet government either couldn’t or wouldn’t make the necessary economic changes to improve the lives of the people. The CCP learned that lesson, and the rest is history.
Xi would be right about the first item, although it would hardly do him credit. Two observations are pertinent as to the second: the USSR would never have received the international support for a liberalization program that the Chinese did; and Gorbachev was a better Marxist than Xi, because he believed that a transition to a capitalist society would inevitably result in dramatic changes to the government. The CCP, in effect, proved Marx wrong on that point.