This is in no way necessary, and is almost never what's going on. All that is needed is the factory owner quietly telling the town councillors that if they are forced to clean up their emissions, they will not be able to compete with foreign competitors who don't have to do the same, and will be forced to close. Then the town council takes a quick look at just how much of the wages and tax revenues of the town come, directly or indirectly, from the factory, and make sure nothing threatens it.
Now that tariffs are the issue du jour, I'd like to propose that any environmental regulations or labor laws should always be combined with an automatic tariff on any competing products produced in countries that do no have such laws. To not have that means that you are not removing the problem, you are just moving it to somewhere without such laws.
Thing is, they're usually _lying_ when they say that. A while back I was looking at buying a house that was near a local authority recycling centre, so went on the EPA's website to see if there were any complaints about it, and went down a rabbit hole of reading regulatory action documentation (everybody needs a hobby). A very common pattern was, basically, company says "if we fix this, we'll have to close", regulator says "don't care, it's the law, fix it", company fixes it, and unaccountably fails to close like they promised, life goes on.
There are exceptions, of course, but a lot of "following the rules will make us unviable, so let us ignore the rules pls" rhetoric from companies is just rhetoric intended to marginally reduce costs. See RoHS; manufacturers acted like it would cause the collapse of modern civilisation, EU pressed ahead anyway, and 20 years later somehow modern civilisation is still there, albeit with somewhat less lead and mercury.
The cars are basically some combination of the NTA's and the local authorities' fault; a massive expansion of Dublin's bus and commuter rail capacity, and a new metro system, are all years behind schedule, largely due to planning permission nonsense (though also due to disastrously incorrect government planning about 15 years ago, which assumed that Ireland would go back to its traditional perma-recession after the financial crisis, with the result that starting these expansions was delayed by about a decade).
One way to address this sort of localism (where there's a significant risk that the owners of the factory are slipping the town councillors the odd brown envelope) is a national regulator. The Irish EPA, which was created to take this sort of thing out of the hands of the local authorities, has been very effective in reducing nuisance pollution; the local authorities used to be mostly pretty useless. Any industrial facility of this sort would be required to self-monitor, and would be subject to inspection; it would have to respond to any complaints, and if the regulator wasn't satisfied it could demand improvements, on pain of withdrawing its operating license.