(I'm an Architect who has built in SF)
Parking spaces, front yards, back yards, building heights, building types, density etc are all City Planning functions, and you're right, have little to do with life/safety typically, and in many ways are quite destructive by making walkable livable cities very difficult to do now.
The Building codes, on the other hand, have evolved with each disaster over the last century or two - a building collapsing in an earthquake, people dying in fires, etc. So those have real life/safety protection as a primary directive.