It doesn't have to be a huge city. I'm in a midsize city not in the Bay area, and I agree with everything you're saying about places like Boulder.
I wrote this to contrast any size city with places like the endless suburbs or rural areas, not to create a hierarchy of "biggest is best".
Problems do also scale with size, so it's not like the massive benefits of cities are tradeoff-free. For as great as San Francisco is purported to be, they have a huge homeless problem that they seem to do relatively little about.
Smaller cities like Boulder, Fort Collins, etc offer a decent amount of variety while eliminating the majority of the problems with the large cities.
Career is about the only thing a big city can be critical for and you have to be in the right city for your field.