To solve the problem of determining whether a city has slaves, and to ensure that this information is persisted between save games, would it be possible to create invisible 'slave placeholder' tile improvements under a city to keep track of how many slaves are in it?
From what I have read, there is no limit to the number of tile improvements you can have, nor a limit to the number of improvments that can exist on a given tile.
You would only need 7 tile improvement, representing 1, 2, 4, 8, 16, 32 and 64 slaves respectively, allowing you to represent up from 1 to 127 slaves (eg. 7 slaves is represented by a 1, a 2, and a 4 slave tile improvement stacked up on the city tile. It may seem a little silly to cater for situations with that many slaves but if you don't, some clever clogs would come along and break it. Obviously if your Mod/Scenario allowed more cities of more than 127, you would need to add a 128 slave tile improvement.
You would need to catch any event where a slave is added to the city, or any event that removed population from the city, and event that converts slaves to citizens, and adjust the tile improvements accordingly.