If only businesses would operate under Ayn Rand Objectivist principles, then the free market would be awesome. Unfortunately, some can be petty, fraudulent, predatory, conspiratorial, discriminatory, dangerous, and even violent. When left unchecked, we can drag out thousands of examples of bad behaviour. It is unacceptable to say "well you can sue them afterward" because often there is no money left to pay a judgement by that point, employees have been maimed, and lives have been lost in the interim.
Or maybe you think that apartment buildings would be just as safe if we had no building codes and no inspections. Cause, you know, the free market cures all. Or perhaps you would just blame the person who bought the house because its their personal responsibility to know structural engineering, electrical engineering, materials science, and plumbing.