Sensationalist headlines get clicks, period. That's how they make money.
I've lived in the San Francisco Bay Area since 1989 and in CA since 1969. I'm from Chicago, and trust me, good/bad neighborhoods shift over time. Also, most people who move out of CA are poorer than the ones who move INTO CA. On average, CA actually keeps more of its residents than most states.
It has always been a state of migration and always will be. And studies - even current ones - consistently show that over 80% of residential change of addresses occurs within the state of CA.
Remember, you are looking at numbers of people moving, but not necessarily percentage of population. We have almost 40 million residents.
San Francisco is a very small part of the San Francisco Bay Area, which in itself is a small part of what is considered Northern CA proper. There are over 100 cities within the SFBA, which does NOT include the Napa Valley or the Delta (where the state capitol is located).
The city and county of SF is 7x7 miles - you can walk across it, and I have - and has roughly around 800+K people. The SFBA has 7.1 million residents, which is, again, just a portion of those in Northern CA, and does not include Central CA nor Southern CA, both of which are larger in area as well as population.
Cities have crime. We deal with it. And we live here because the advantages outweigh the disadvantages. Most homeowners, for example, probably don't pay much more than you or your grown kids do for housing. Like most Boomers, paying off the mortgage is just a matter of time. For Gen Xers, their mortgages are higher, but so are their salaries. CA paychecks, especially in tech, are sizably bigger than elsewhere.
Casual crime - or lower level crime - is up across the nation. Theft, burglaries, auto break-ins, etc. If you live in any major city, you know exactly what I mean, and like the rest of us, you take care to avoid high-risk areas. Sometimes you can't, but most of the time you can. That's city life, which my spouse and I happen to enjoy the benefits of having, and accept what disadvantages there might be. The latter hardly impact our lifestyle or decision-making at all, honestly.
Unless you live here, it would be quite difficult to "know" a city. Half my family could not tell you what SF is like, because they never have any reason to go there, even though it's only about 35 miles across the Bay. Their entire lives are in a major metropolitan area that is part of, and yet separate from, San Francisco proper.
My MIL lived in the West Portal neighborhood of SF, close to St.Francis Woods. It is beautiful (if foggy), lively, full of families, good transportation, and she would have gone back there today to live in a second if she could. We would have no qualms about her safety, either. But with dementia, it was time for her to move in with us, and that was the ONLY reason.