The answer to grandfathering things in is not to give them an indefinite examption from the rules; instead, give them, say, a 10 year period of exemption, giving the owner enough time to fix the defect and to spread the expense of doing so over time. It's not perfect, but eventually everything ends up being fixed.
It depends a lot on context. That's certainly a reasonable approach in some situations. However in this instance it's not clear to me that there's any possible way to comply with modern regulations. My impression is that in general it isn't permitted to keep massive tanks of hazardous industrial chemicals 500 feet from residential housing units in the middle of the city.
I think this is an example where it might have been reasonable for the taxpayers to foot a bill to facilitate their relocation 20 or 30 years ago.
Take this into context with the outsourcing of all such work to China though. Environmental regulations are assessed to be one of the largest impacts US GDP. We take that hit to protect human life, and then by all the stuff from China that they make without those regulations. We minimize any risk of harm to our citizens at the cost of their jobs, while putting the citizens of China at risk instead. My only point is that there is no right answer. It is a judgement call about how much risk we think is acceptable in trade for what modern conveniences. If paying to move the plant would cost more than what it produces provides us, we should decide whether we do without, or just accept that sometimes industrial accidents kill a few hundred people.