I'm sure some of it depends on what you're trying to accomplish in life, but since you didn't specify I'll answer for myself (someone who just wants to do work I enjoy for a really solid upper-middle-class paycheck and retire early)—no, you don't need to be in the Bay Area.
EDIT: To give some concrete numbers, San Jose and San Francisco represented ~180k of the nation's ~1650k software developers in 2023 [0]. That's ~10% of all US-based software developers and ~0.6% of all software developers in the world [1].
[0] https://www.bls.gov/oes/current/oes151252.htm
[1] https://www.linkedin.com/pulse/how-many-software-developers-...