The point is many buildings collapsed in Chile's 8.8 and Japan's 9.2 earthquakes, thousands in fact. The seismic isolation with sock absorbers which are trending on social media are very expensive solutions set aside for bigger projects, so they're not used as extensively as people think they are, even in Japan. For apartments, it's important to have the metal thoroughly stick to the robust concrete; this ensures kind of a controlled and delayed collapse, in worst case scenarios, giving enough time for people to evacuate. Mustafa Erdik (one of the foremost earthquake engineers of the world right now) went on multiple t.v. programs laying out the perfect plans to make sure these reforms happen (including a professionalized civil engineering class, much like physicians risking loss of permits, put to test regularly to keep their licenses etc., a mandatory professional liability insurance, using precast concrete sidestepping on-site manipulations of test samples, etc. I recommend everyone watch them.
A harder subject is implementation of these theoretical and legal constraints and regulations. We all know that doesn't happen perfectly due to both corruption in the institutions and happy-go-lucky attitude of our people (the corruption itself in return stems from this attitude anyway). So the laws and regulations will have limited effect in execution (limited but not non-existent, so they are a must). You cannot expect children who have grown up, being given warnings, tasks and admonitions by their parents but not facing any of the promised consequences to go on and give a damn about laws and the consequence of violating them later in life. This lenient attitude and lack of discipline in upbringing is the main culprit, because it creates a generation of people who don't care about laws and their implementation. No matter how much you bring the contractors to justice now, those deep-seated habits will not go away, that is why punitive justice doesn't work in so many cases because that doesn't change the character of a population; character is formed in formative years of childhood and early youth.