The big issue is I don't think tribal invasions function as they were supposed to: to a Muslim AI this actually makes the realm stronger since it basically hits the reset button on decadence. I haven't the slightest idea how to put this in but maybe upon a successful tribal invasion the realm fractures; make it so that it functions almost like gavelkind except it fires while the new Sultan is alive. The personal holdings of the old sultan would be divided amoung the new one and his 2 oldest sons or male kinsmen, and the realm significantly downsized. Old vassals would be rendered independent but could possibly re incorporate into the realm or even try and usurp it.