It's possible to do this purely through XML, by modifying things like the unit maintenance formula, or increasing the resource costs of various units, and so on. You'll need to have a very good understanding of exactly how the game is balancing things, though, and the mechanism you use will depend heavily on what your vision for the final balance should be.
For instance, you could make every military unit require units of a new strategic resource, called "Training". That resource would only be produced by buildings, mainly the military ones, and the AI would get twice as much of it as a human would (since the AI needs a numerical advantage to stay viable since it's so stupid in combat). But this'd have all sorts of other balance issues you'd have to consider, so it's not the sort of thing you can do on a whim.
Likewise, you can change the Happiness equations. Maybe instead of 3 + 1/pop, you make it 4 + 1.2/pop, but then add more +Happiness buildings. This'd have the net effect of slowing down expansion, since each city would need to produce more buildings before it broke even on happiness. But obviously, this requires a lot of other changes to work. (I didn't just make up those numbers; that's what my own balance mod used.)
But without knowing what exactly you mean by "unit spam" or "city spam", we can't answer your questions.