Description:
In some cases, incorrect city count penalty can be applied.

Expectation:
The city count penalty should match player owned city count.

Actual:
A city might be captured by AI in some situations with the city count not decreasing.

In the screenshot below observe 3/2 city count, but only two cities.


Repro:
?/5. Only reproduced once.

Steps:
1. Make your city become under siege by AI and choose to endure the siege
(2). Maybe ensure that your unit is next to the sieging AI unit
3. Receive a battle request while the siege is ongoing
4. Attempt to retreat.
5. Observe that the AI captures your city and your city count does not decrement.

This could be a confluence of several bugs and I can't give a very clear description. But it can easily be resolved by recalculating AI/player-owned cities when cities are captured.