The analogy the OP establishes - building a house vs making software - is good (I've actually used it too in debates), but things are not as tightly regulated by the government as the OP claims:
* While there are certain constraints a house has to satisfy, architects do have freedom to be creative. They MUST plan such that it will resist certain standard incidents, and they have to plan it such that the floors can carry ~10x the weight you would ever expect there. These regulations vary depending on the region you live in. E.g., in Austria there is the possibility that meters of snow lie on roofs, and architects (or their structural designers) have to keep that in mind when calculating the max weight. You won't find this constraint in Portugal.
* Keeping to these constraints does not guarantee a building won't break. Constraints (like requirements) are prone to grow outdated, or be incomplete. In Austria, roofs will sometimes break down when it snows for some days in a row (4m of snow are very heavy).
* As incidents in e.g. Turkey and China show, plumbers or other construction workers can do such a bad job ("botching") that buildings just break down after some years. Governmental constraints don't assure quality. Some countries like Dubai won't let local workers unguarded near any expensive building for this exact reason - most of the times, German and other Western workforces are hired to oversee the construction process.
I think one could compare governmental constraints on construction work with requirements. A building's floor must be able to carry a weight of 100 tons, and a software system should be able to serve 1000 requests/second - I think that's comparable, and software constraints might even be easier to test.
What I think this really boils down to is that software requirements evolve much more quickly, and due to this it's not feasible to establish legal requirements - government would have to issue new requirements every week, adjusting them for technologies like nodejs. Also, how do you establish best practices for bleeding-edge technologies within weeks? Not at all. We are in a constant state of learning and experimenting.