They deliberately flouted codes,play stupid games...
At newest, the building was probably WW2 era construction, probably fell into disuse in the 1960s or 1970s.
IF it was code-compliant for current industrial use, virtually any renovation with permits probably would have triggered a very extensive and expensive mandated retrofitting to make it partially compliant with new construction codes,
just for industrial use. But as you suggest, it was being used for human habitation (and looked like an antique store or hoarders' hang-out), for which it was not legal, and this "party" was basically using the place as an entertainment venue. It was a predictable disaster.
It was also the product of liberal governance that politicized basic functions like policing and building code inspections. This place had been inspected and found non-compliant a month before, but only after neighbors' complaints and probably after years of non-compliant use (and maybe years of complaints!). Had some developer tried to "gentrify" (= convert to housing) this building, the City of Oakland would have been all over the developer, harassing and milking $$ from them. But this was an "artists' collective", so bureaucratic myopia was the order of the day.