But San Francisco isn't Silicon Valley. For most of the history of Silicon Valley, SF wasn't any part of it. It is only in the last decade (roughly) that a handful of high profile companies have established in SF, so arguably, perhaps, SF is today part of Silicon Valley.
Even today, none of FANG is HQ'd in San Francisco.