Fridge Logic: Kei's gender appears to be male, so why not just transition him into a boy? Shouldn't the doctors have known that when they first mentioned it? At least he can transition once he moves out.
The issue is less about the outer gender and more about the inner assets. Kei/Megumi are apparently the kind of intersexual where the inner genitalia and the outer genitalia differ. Meaning, while there is a penis with scrotum, the scrotum doesn't work and instead there is a working womb. While it is absolutely possible to make a almost perfect "working woman" out of this situation (as it is mostly a visual correction with the only downside being a artivicial vagina, though a good doctor can do wonders there), it will always leave a infertile male, if going the opposite way.