I have done some experimenting with it in my personal mod (trying to weigh in traits, religion, distance, tier, culture, dynasty, and de jure status), with varying results. Sometimes people who should be very unlikely to split off decide to do so while those who should be very unlikely to not split off decide to stay loyal. It would be possible to make it very random or very rigid, or somewhere in between, but sometimes the RNG will likely cause strange things to happen.
If it makes sense, that could work; though it would need to ensure that there isn't a big cultural/religious mismatch (and possibly that ambitious vassals refuse to swear fealty to someone they don't like) and that the new kingdom only contains people in its de jure area or very close nearby as the independence faction could have members from opposite sides of the map in it. Something else that could be a possibility (though that doesn't really work with the current mechanics) is if the newly independent states formed local alliance blocs that only allows calls if they are attacked by someone who isn't part of said bloc (e.g. Italian breakaways from the HRE generally defending each other from the Kaiser, the Pope, and various MRs, but infighting amongst themselves from time to time as they try to form Italy first).
The former liege could also be forced to refrain from foreign wars for X number of years (5-10 probably would be long enough to prevent an instant reblob while not preventing the former liege from doing anything for a too long period of time) as the focus should be consolidation, which should make the AI a bit less suicidally stupid when the realm is much weakened and there might be nearby realms that wants to take a bite from it.