Solution 1:

A city state is a civilization in many aspects. They research at their own pace, they build stuff at their own pace, and they also have things like happiness and upkeep

A city-state usually will have low happiness, which will put them below 0 when they capture a city. This will prompt them to raze said city, but in rare cases they have enough happiness to keep said city, in which case they'll puppet it and not raze it if happiness goes low afterwards