My opinions-
Early ages, until around end of Enlightenment (in this order):
Stronghold
one Stable to max
one Garrison to max
Mortars
Ballista Towers
Stables
Garrisons
Towers
Command Post
Redoubts
From Industrial onwards:
one Tank Depot (Stable) to max
one Garrison to max
Anti-tank Guns (Ballista Tower)
Towers
Air Defense
Bunkers
Tank Depots
Garrisons
Stronghold
Mortars
Machine Guns (Redoubt)
Sniper Towers
Silo and Rocket Arsenal both entering the list as top defense priority to build as soon as you get them available (obviously).
Some notes:
My order is based on what I experienced to be most popular attack styles in the early and later periods of the game. Early game, mass infantry/mass ranged siege and infantry attacks are common, so the splash damage buildings are important defense. From Industrial or Global onwards, your priority should be your defense vs planes and vs high HP units (Heavy Tanks in particular), thus Anti-tank guns and towers/air defense become most important.
Whenever having advanced ages and having new buildings available, I suggest building those first, as those only take a couple of days (or only hours, for Towers/Stables/Garrisons), adding some defense power + more map area to cover for your attacker in short time.
However, you should always first focus on maxing your age's offense before doing pretty much any defense. Better army = easier raiding = more resources.
Additionally, I prioritize several traps over defensive buildings: after or while you're doing Towers and Air Defense, focus on SAM batteries, these are absolute beasts once they reach atomic level and higher.