The location of the earthquake is pretty much on top of a plate fault so earthquakes are to be expected, especially big ones
But the problem is not that you can't build for big earthquakes, more that the whole area is a low income one with everything that along
It is possible to build for a 7.8, at least so that the structure doesn't collapse (severe interior damage is inevitable). But many older high-rises in San Francisco were built to weaker standards or on soil subject to liquefaction and would be at serious risk.