If a contractor sets out a building incorrectly but it is not discovered until the end of a project, by which point floor tiles are being laid, what is the correct procedure?

This depends upon the nature of the error. The worst case scenario is the building encroaching on land owned by another person, under which circumstances it is likely the section of the offending building that errs will probably have to be destroyed.