In the long run, I'm not sure that's actually true. It really depends on the kind of regulation you're talking about (e.g. not so much with anti-trust regulation).
Ultimately, most people want some form of quality control. When I buy milk, I don't to have to inspect the dairy farm myself. In the end, you still have industry regulations and winner pickers, it's just that the decisions and processes that control them are behind closed doors. Trying to navigate that as a small player can be very difficult.
Regulations are a racket, but at least with government regulations, that racket is democratized.
The building codes aren't the way they are because you need different rules for smaller buildings. It's because existing residents don't want smaller buildings. If you can build smaller buildings then people will, and then you have a bunch of new students in your school district whose education is paid for from local property taxes, only their parents aren't paying a proportionate share because they have a smaller house with a lower property value. Which means the existing residents would have to make up the difference, which they don't want to do, so they have the building code prohibit building smaller homes.
It's basically regulatory capture by existing homeowners of larger homes.
Zoning can explicitly set lot size minima or density maxima.
Building codes with specifications for door and corridor widths, accessibility ramps, minimum room sizes, bedroom counts, bath-bed ratios, height limits, basement exclusions, attached vs detached dwellings, "in-law" units, with or without seperate entrances and/or cooking facilities, etc., all indirectly efect housing size and density.
Local jurisdictions will usually have addenda to the code, for local fire requirements, etc., but a lot of that flexibility is baked into the standards themselves. In here there may be regulatory capture from local builders, and at higher levels (state-wide) there may be some capture from larger construction companies, but there's very little in the way of a feedback loop to allow homeowners to significantly change the building code.
Rather than debate in abstracts, I'd be curious if there is a particular section of the code that you feel is a result of this sort of capture. The IBC is available for browsing online [1], and Chapter 5 has the base restrictions on building size, with some notes on justification (largely about at what size you require additional fire suppression, which is a cost that most builders want to avoid in residential settings).
There's another fine line between regulating desired outcomes vs. regulating _towards_ desired outcomes. Using regulations to "nudge" towards a social good often means that the market, wiggly customer that it is, uses that nudge to push in directions that are not the desired outcome, or that achieve the desired outcome only in a technical sense.
The negative examples are rampant; the good examples are harder to find, because a good regulation is nearly invisible. Take building codes as an example of good regulations, although if you've ever done a remodel or been involved in construction, you know that they're not _actually_ invisible. But for the most part they just make sure that buildings are safe and support certain common conventions that make future maintenance and upkeep a little easier. The goal of the regulations is to make sure that new construction adheres to certain standards of quality, and so that is what they do.