I agree that XP gains should vary based on some increasing function of the combat strength of enemies, and quests could have mild xp rewards. Taking cities could also give xp, or it could just increase the xp you get from the defenders of the city relative to how much it boosted their combat value. [I don't see any reason to gain more XP from capturing a city with no defenses than from fighting the same army out in the field.]
Alternatively, have some kind of D&D challenge rating system, where you get more xp for defeating somethnig more powerful than you are, but less xp for defeating something less powerful than you are.
Not sure that founding cities or going up spell levels should grant xp; there is already magical research to give you more essence.