I think it depends on the nature of the illness, and whether transitioning will help or hinder the healing of it.
I have DID ("multiple personalities"), and my System darn near demanded that I/we transition...since then, I/we have integrated several of the Alters and we've achieved a stability that was unheard of before HRT. My depression is much better, although I still have "episodes", they are also much shorter duration and less overwhelming than before.
A diagnosis is never an automatic "Ooooh HELL no...!", it depends on you and how transitioning will affect you. (An exception to this would be if you are not capable of making your own medical decisions.)
I'm not a doctor, lawyer, or anybody but myself.