If machine gun fire were a daily occurrence for residential houses, they would be. Every other common occurrence that occurs to residential houses, whether it's fire hazards, snow load on the roof, earthquake protection, etc. is part of the design consideration for residential houses.
The fact that software _predictably_ gets attacked when placed online is exactly what means that developers can't shrug their shoulders and pretend it's an unforeseen event.