It is not the only way, WHO provides a code “gender incongruence” that is a condition “related to sexual health”. Not a mental disorder. https://www.who.int/standards/classifications/frequently-asked-questions/gender-incongruence-and-transgender-health-in-the-icd
It could pass a Gender Identity Recognition Act by self-identification. Then cover trasngender health by insurance, prohibit healthcare discrimination on grounds of gender identity, and use a modern, non-pathologizing code the one provided like ICD-11 by WHO “gender incongruence” a condition “related to sexual health”. Not a mental disorder. https://www.who.int/standards/classifications/frequently-asked-questions/gender-incongruence-and-transgender-health-in-the-icd