When you raze a city and your population in the capital city is capped due to food it doesn't matter how many slaves go to your capital city because on the next turn the capital city's population reverts back to the number it is capped to. My suggestion is that if your city is overpopulated by any reason the population would decrease by a set percentage until the capped number is reached.