I also think the libertarian argument that all market regulation is always a net bad is just stupid, quite frankly. The regulation of things like railway gauges, electrical outlets and such, allowed for economies of scale to emerge that would have been far more Balkanized.
Libertarians argue there's no such thing as market failure -- only government failure. This is dumb and wrong.
But to your point, certainly there's a lot of bad regulation. And I rail against bad regulation all the time. In particular, land use regulation and things like NEPA that have allowed NIMBYs to destroy housing affordability in this country.