And why courts would be that way? Maybe because the legislation is overly complex and extensive trying to regulate everything, and government is too busy trying to do 196797698 things that it shouldn't be doing toi do the thing it should correctly.
If the houses in your examples burn it will be a trivial matter to determine the cause and there will be a lot of witnesses. The company will have to pay a lot of money in compensations which will make it much cheaper for them to do it right, even because the maintenance costs for doing it wrong are considerable. Regulations are irrelevant here, the responsibility for any accident generated by their equipment is theirs and that is enough.
The funniest part on your example is that the worse and most irregular electrical installations are those made by State owned power companies in countries where the State tries to do even more than in US, and in these cases there are no consequences at all, you can't even sue them with any hope of receiving anything.
Regulations only serve to create gargantuan regulatory bodies, which basically exist to sell favors, block competition and perpetuate themselves. Bodies that do not grant any measure of increased security compared to a judicial system that works.