This is a devastating situation for you to be in, and my heart goes out to you. And with your wife apparently being a control freak (from the tone of your previous posts) it's easy to feel like she's holding all the cards and is in control of the situation. But that's not the case at all. That's just what she
wants you to believe so that it'll be easier for her to ride roughshod over you. You do
not need her to give you and your child a fighting chance. Who died & put her in charge of this situation? She doesn't get to decide its outcome - that's for the magistrate/judge to decide!
OK, hard truth: you now know that your marriage is unsalvageable. She's filing papers and once a partner has made that decision, it's almost impossible to convince them otherwise. So now what you need to do is to have a good cry/scream/whatever to get the initial shock out of your system, and then go into a self-defense mode. She's likely to be ruthless with you, so you must defend yourself and your child from her machinations.
I see you're in South Africa; sadly as you know South Africa is still in the dark ages when it comes to some LGBT issues, but we do have laws to protect us. Look up the Children's Act, Act 38 of 2005, which confers equal and joint guardianship status on both parents of children born from marriage (
here it is for your convenience). It's no longer true that the mother automatically gets custody. But what can you do to weaken her case and strengthen yours? Can you put together a record of the emotional abuse she's committed against you? Has she done anything in front of your child, like scream at you or hit you? Document everything, and give it to your solicitor as evidence.
Look for LGBT societies or support groups in your city or province, and contact them to see if they can recommend any good LGBT-friendly lawyers who've fought hard for trans (or gay) clients to help them maintain custody of their kids (or to get reasonable contact, if that's your preference). There are quite a few Attorneys, Barristers & Solicitors who are LGBT-friendly, so ring them up and ask for a consultation to talk through your case. You'll benefit from their specialist knowledge, especially if your wife tries to use your trans identity as a weapon. An inexperienced solicitor may not know how to defend against that.
I'm not going to try to sugar-coat it: divorce is horrible and I don't recommend going through both a divorce and a transition at the same time. Each is almost as stressful as a death in the family, so both together would be very detrimental to your health. She's started the clock ticking by filing papers to pull the plug on your marriage, so I'd very strongly recommend you concentrate on the divorce first.
Be aware that the grounds for divorce in South Africa are very strict and specific. I hope she's filing for a 'no fault' divorce, which would be fine. But it sounds like she's using your suicide attempt & rehab as grounds for bringing a 'mental illness' claim against you, so you'll need to defend against that... and the best way of doing so is to get a formal diagnosis of Gender Dysphoria (if you haven't already done so) along with a clean bill of mental health. If you get all your ducks in a row and can show the court evidence that you're not mentally ill and not a threat to your child, she'll be unable to use these things against you.
Sterkte, Amoré. It's going to be a rough ride for a little while, but it will definitely get better.