Not to discount the benefits of living in Silicon Valley. If you love the atmosphere and everything then it's probably the right place, and that's worth a certain amount of money. But just looking at the numbers in a spreadsheet it's objectively better to live in a small-to-medium sized city (or even rural area if you can find the work!) if you're looking at take-home pay, savings rate, retirement savings, etc unless you're in a very well-compensated role in one of a few very select corporations.
I lived in SF and NYC and eventually found my way to Nashville, partly for low taxes. However, I'll be moving back to NYC, because despite the ridiculous levels of taxation, I just can't help myself and I'm fortunate to be able to afford it. I'm always looking for ways to manage my tax burden though.
I was from the Bay, and moved to Reno. I really miss Asian food and Asian people.
Heck, I was even thinking of going to conversation clubs at UNR just so I could hear Chinese spoken again, and maybe eat some dumplings.
It sounds like you live in California? If you're a decent software engineer in any major city in California, you are one of the luckiest people who has ever lived. You have your choice of employers paying you six figures to sit at a desk and push buttons 40 hours per week.
If you're overworked and underpaid to the point that what I just said sounds crazy, it sounds like you need a new job, immediately. There are better options out there, don't settle if you're miserable.
Some of the other points you mentioned sound like you might want to speak to a professional therapist. There's no shame in that (I've done it before and will again) and it can really help you work through some issues.
Good luck!