That's the surplus, not the economic output. To know whether that is a net positive you would have to know what would have happened to it in the alternative. The customer might have paid less and then used the money to pay for something important like medicine or education.
But the economic output is separate from that. The issue there isn't that the customer has to pay more, it's that the amount the customer has to pay is now too much and they drop out of the market. Then they don't get the product -- and if the product was something important like medicine or education, that's quite problematic. And the makers of the product also lose that business, which reduces the total amount of surplus that exists to do meritorious things with. And the government loses the tax revenue. That kind of dead weight economic loss is very bad.
It won't be lost. It goes toward preventing work related injury, or harm to the customer. It basically prevents manufacturer from dodging social cost his enterprise impairs on workers, customers and people who live nearby. This way it can be and is included in the price and also it's cheaper altogether because it's almost always to prevent then to treat.
Regulation can save everybody's money.