The plant was built after the houses but likely well before we had anything resembling modern safety regulations regarding such things. It was presumably grandfathered in for no reason other than that arbitrarily putting someone out of business after the fact is generally frowned upon. https://news.ycombinator.com/item?id=48254291
That company (GKN Aerospace) was recently fined $900k by California for various violations dating to 2020 (including instances of incomplete records and missing permits). To be clear my intent isn't to single them out. I cynically assume at least some amount of that behavior to be par for the course with US chemical companies.