They are liable for things like earthquakes and explosions, though, up to some limit:
https://www.fema.gov/emergency-managers/risk-management/eart...
Actually, they are.
Engineers are tasked with designing safe structures taking into account a bunch of failure modes, not only those that involve safety but also usability.
These failure modes are even covered in standards, and engineers who fail to design projects which are safe under these scenarios are held liable both civil and criminally.
Software, on the other had is expected to stand up to being exposed to nation state level threats that we know about, as well those in the future that we don't know about.
We can't get mad that Sony was hacked by North Korea in the same way that we wouldn't be mad at the engineers if the studio building burnt down after being bombed by the North Koreans.
We might, if military attacks were as commonplace, untraceable, and unpunished as online attacks.
I would offer that there is good reason why building security (e.g. police) is its own profession, not a traditional engineering discipline.
[1] https://www.cpr.org/show-segment/this-man-barely-escaped-kil...
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.
How often do the people who pay for the software plan for that in their budgeting? Supposed I were to say this software has been pentested before release and it'll cost this much extra. How many people are paying for that? How many people will pay for it to be pentested each year for new vulnerabilities?
Most residential doors I've seen can't even stop someone with a credit card or metal shim, unless they have and actually use the deadbolt. The vast majority can be picked with ease if you have experience (and hackers typically do). You can also just check windows, since most people don't lock them.
If you don't have to leave the door intact, there's a billion ways to get in. You can ram through the door, since they're not terribly thick. You can drill out the locks. You can saw through the hinges and/or the bolts. If you really don't care, any number of guns can remove the locks or hinges.
An angle grinder will neatly handle any safe you're likely to find inside.
Firearms and tactics evolve over time and very few things can really be blamed on the engineer. The rules for PE are also based on evidence of due diligence on known problems rather than absolute liability, because nobody knows everything that could happen, and can't cover all possible failures. You should read up on how tanks are destroyed or stopped in inventive ways in guerilla warfare, such as in the ongoing Ukraine conflict (it's not just failure of maintenance) or in Vietnam war.
I also don't understand why you could selectively skip the part about novel chemicals.
When it comes to software operating within known constraints, we're usually pretty good at delivering. The software in your car, for example, may be full of security holes if a human decides to attack it, but as far as working within the known environment, it is likely to work just fine and as expected. That is all we would expect of a professional engineer.
If you want to stop people from driving bulldozers into your buildings, you're going to have to look beyond the engineers. That is not their area of expertise.