Seems like this roughly happened in Kaz:
Tokayev President in name only, Nazarbayev people in most ministries. They hike taxes, unpopular, Tokayev people organise protests where various paid protestors got drunk and started rioting and where the protests were surprisingly well attended by people who were not paid for.
Tokayev then uses that to force government resignation to take more control but Nazarbayev still in command of security until he is forced out of those roles as well.
While the protests happen an ISIS cell activates in Almaty and hits the banks for cash and locations of arms for weapons, they were organised in advance. The militants are now set up for an insurgency having been previously waved through Turkish airports coming back from Syria, albeit without money or gear. This is when the 24hr a day gun battles start in Almaty but not really anywhere else.
There are Salafist mosques in Kaz, Saudi funded, so they can draw brainwashed local plebs for an insurgency. Hence the immediate Russian/ CSTO response and Blinken boiler plate comments and various references to foreign terrorists and external interference.
The mountains immediately south of Almaty into Kyrgyz are a perfect hiding place and stretch way west into neighbouring countries. So Kaz closed the Kyrgyz border today. Hard to call this, but ISIS will fight to the last person so the authorities have to end it fast. The Russian planes are presumably to bomb in the Tien Shan mountains.
The militants have spread out in Almaty into ordinary buildings and the Kaz SF have to fight each one. Assuming they clear out Almaty they will end up having to fight them in the Tien Shan mountains if this is correct and the ISIS group can maintain the funding, weapons and people supplies. Those mountains also run through Kyrgystan and Uzbekistan.
Kaz is so physically big I don’t think this threatens the country overall, at least for now, but its hardly an economic positive.
Update,
The Kazakh Liberation Front released a video promising to fight, and they dont look like vodka addled rent-a-protestor types.