That's eye opening. When someone buys that thing, will and inspection show that it is substandard and dangerous?
Good question. In the world of inspectors, you have building inspectors that typically work for the city or county. They assure compliance with local building codes. Building codes are primarily concerned about safety and integrity of the building. Building inspectors insure code adherence of involved trades. Hence electrical, plumbing, structural, etc. That's where building permits come from.
There's another breed of cat that's more about used homes. They are independent businesses that usually get involved when a property is being bought/sold. They look for code compliance among other things, but have no authority to enforce building codes. It's more like having a used car checked out at your mechanic. They should find this kind of deficiency, but I have little faith in them in general.
Assuming there's a permit that would include inspections, this would likely trigger a red tag and would have to be corrected at least before a certificate of occupancy would be issued. If it were around here, a "cease work" order would likely be issued until the safety hazard was removed. There are (mostly) rural areas that don't really have building departments and inspectors though, and this might fall into that category.