I had a similar idea, but it was for Resistors, I think I'll start afresh for this one, and maybe start a new thread for Resistors (its burried somewhere).
I think Civil Wars should really have a lot to do with culture, unrest, and disorder. I think when a city is going to flip due to culture, it will first riot (attacking and killing the military units in the city before fully forming military units). Then the city will get a white (Barbarian) border and any units produced will take the name of the city. Of course, since this a cultural flip, they will probably pledge allegiance to a new nation in a turn or two, if you don't stop the rebellion sooner. Than the new owners can bring units to the city, and the city will join that nation.
Civil Wars can also be caused by unrest (say pop-rush, or just unhappiness). They happen more frequently than culture, because unhappiness is more common. But they aren't necessarily going to flip to another nation. They will probably just attack you, trying to capture new cities.
BTW, if there are a lot of cities in unrest at the same time that riot and rebel, you have a much bigger problem. They take the name of the first city to rebel and, although some cities might peacefully submit again, the rebellion might spread as well. Although content cities will usually stay loyal if they feel safe. But they will launch organized war against you, and might have a chance to defeat you (if you are destroyed they take your civ color, and your civ, as the new government). If they take your capital, there is a chance many cities will defect (assuming you don't have lots of units to stop them).
There are ways to stop them. When they are rioting and in armed resistance, military police can stop them (sort of like stopping resistors), but, in democracy, this can cause more unhappiness. Police Station work much more effectively. If the units in the city are killed, you can use any force necessary to bring the city back under your control. Aside from that, just keep them happy (or under control).