Well, you could do this through Lua. Create an unbuildable (cost=-1) building that requires a unit of iron. If an iron-using unit is destroyed, then spawn one of those buildings in your capital. Of course, if you lost your capital, this penalty would transfer to the civ that took it, unless you set the building to NeverCapture, in which case you taking back the city wouldn't re-enable the penalty for you.
The big question is why you'd do this in the first place; it just seems horribly abuseable, since the human players always have far better kill ratios than the AIs. You'd very quickly make it so that the AI could never build a resource-using unit again.