Every buildings we add, every unit we add, every promotion we add, every civilization we add, every leader we add, etc., etc. adds to the static base memory footprint before you even start to consider maps etc., so yes, it is continuously going up, and lately has been doing so quite fast.
Perhaps every civ should have like a treshold of available building slots. Technologies could allow you to have more buildings. You could have to raze old stuff to make room for new buildings (like in a real life city).
As I understand a max unit treshold is already in place? Or was at elast in vanilla Civ4...
"Tresholded Buildings" could be thaught to the AI quite easy, I think (at least for real coders like yourself)
For example, if the AI faces a case of "out-of-building-slots" scenario but initially decided to build building X it will look what other building in the city brings the less revenue and will sell it. As it has a routine to figure out what building it would profit MOST by it would also have a routine to do the excact opposite. Of course the exception must be made that buildings that allow other, later buildings should be excluded from sell-off.
The main idea behind this is to
a) receive an oversight about how many civs A have how many buildings B in what stage C also related to map size D and gamespeed E
This oversight could then be visualized with graphs and be used for optimizing gamespeed, perhaps by either scaling/tweaking the code or tweaking the rules (so bottlenecks that lead to too many buildings in one era for example can be avoided)
b) in terms of gameplay I didn't like the +35% for buildings new gameoption that is recently available as I play an already very low hammer eternity deity game and waiting even longer for the starting buildings sucks. But if I had only available a certain number of building slots, that would be unlocked by tech along the way, by resources (think of stone or wood allowing more building slots in cities), or by traits (excessive leader could build 1 building more in each city or something), I would quite gladly use it.
The building slots are, of course, not the only place to scale, as the same may apply to units. What about having a unit-limit tied to city size and number of cities? (As cities represent the population the number of soldiers should realistically be tied to that population!) How the AI could understand this? Quite easy: the closer the unit count comes to the limit the more expensive the units would become. The AI "knows" that "too expansive = not good, better take other stuff in same field, if possible" and would perhaps build a balista turret in a besieged city instead of a 20th longbow.
Well this wouldn't necessarily help game performance directly as AI just would build a building instead of a unit but with the building limit in place, after all there would be some situations where it could only sell a building or produce wealth science or espionage with the hamemrs which especially in evolved modern era games might be a resolution to not suffer too immense turn times.
tl,dr;
Building slot limits + unit slot limits as possible intermediate solutions for scaling + later gameplay?