They are situational, though I tend to find myself in those situations frequently, so once I learn mathematics, I invariably have a lot of my non-barracks cities building them whenever they have nothing overly important to concentrate on. My current game saw me forced to go conquesting into neighbouring Germany with nothing but archers and spearmen against swordsmen and emergent pikemen/medieval infantry to take their iron. I don't think it would have been feasible without a dozen catapults & trebuchets.
While the same shields could have been put towards more archers, my intuition tells me (perhaps wrongly) it would have been a less efficient investment in terms of production spent versus cities captured, mainly because the softening of city garrisons allows you to reuse attackers because they aren't dying en masse against technologically superior defenders (that they are also promoting at the same time, compounding the problem).