Wow, that is a horrible story. I am sad to see good developers leave our industry, no matter what their sex or gender identity.
I won’t try and convince you to stay because I honestly don’t think you will have an easier time in future (having seen similar stories from other women in tech). I can’t speak for anyone else, but I have had the pleasure of working with some amazing women in tech and my career would have been far poorer had it not been for the lessons they taught me. Looking at your story, it seems like you have had a similar effect on others and I hope that they appreciate what you have done for them.
While I haven’t experienced all that you have, I have also had bouts of severe depression in the past, and I sincerely hope that the treatment you get is able to help you (and that you have a good support system — being around others that are also going through a healing process worked wonders for me).
Best of luck with whatever you choose to do going forward.