Insurance is always a gamble; if you buy it and never use it, you lose. If you don't buy it and later need it, you lose. This assumes you have the money for the insurance of course; Haiti did not have the money for insurance or seat-belts, and got thrown from the car into a concrete pylon.
On the other hand, even disregarding the risk mitigation, it's also arguable that the seemingly burdensome building codes would inflict no appreciable harm on the economy, for exactly the same reasons that the broken window fallacy sounds plausible.
If disaster does occur than the code has prevented the destruction of capital, and therefore has benefited the economy -- maybe not "stimulated", but benefited by preventing a greater loss.
The point being: you can afford the first loss, and cannot afford the second one. If the second half is not true, you have identified an insurance policy you don't need.