This is an interesting read:
https://en.wikipedia.org/wiki/Transgender_history. This is also worth reading:
https://www.petertatchellfoundation....ns-liberation/
As in many recent areas of disagreement, the lack of nuance is evident. There are many people who strongly believe that they are mis-gendered and go through tremendous personal trauma, counselling, medical treatments and invasive surgery to achieve the gender they fundamentally believe they belong to. These people are not "mental".
Society should be able to accommodate these people and, at the same time, ensure safeguarding for the small number of cases where security concerns are raised. You can argue that, in the past, homosexually was treated in the same way: homosexuality was considered an "unnatural" act, leading to punishments ranging from fines and imprisonment to public shaming and even death. Yet, today, it is part of mainstream society.