Gender dysphoria is not a mental illness (although it is sometimes classified as one so people with gender dysphoria can get help more easily). What is a mental illness is depression, which can be caused by gender dysphoria. That's why it's important to do something against gender dysphoria so it doesn't turn into a mental illness.