Avoiding secessions is very hard. As others have mentioned, multiculturalism and low infamy help. As will religious secularism, high welfare pay, and public healthcare, to avoid more discrimination and rapidly increase quality of life. You're also right that buildings will help, but often not soon enough. Consider subsidising local industries to avoid unemployment.
In my experience, the most effective tool to avoid secession is using authority for local edicts - violent suppression, social mobility and emergency welfare especially. With those, I have seen the secession progress bar reverse course.
Tldr spend a lot of time and money and effort in it, or just post soldiers nearby.
I assume this is satire? You could describe all gameplay that way