This is a very general problem in medicine. As much as we'd love to do medicine in a purely evidence-based way, looking as much as possible like the scientific method we're taught in school, it's rarely possible.
* Too many variables between bodies
* Humans don't follow protocols perfectly
* They take too long
* They fail too often, leaving sunk costs
* Experiments are hard to do ethically
And most importantly: you can't just sit and do nothing. When a person is dying or suffering, it's cold comfort to say, "Nobody has paid for a rigorous study, so we're not going to do anything at all".
Psychological problems are even harder. They're nearly impossible to quantify. You can certainly quantify people after they've killed themselves, but until then you've got little more than their self-report to go on. You can make up questionnaires, like they have for ADHD and depression, but what are they calibrated against? In the end, it's just "I feel like X", and they believe you or not.
A sibling comment answered your question pretty well: yes, we can tell that untreated trans people kill themselves at a higher rate. But even so, statistics are less useful than they might appear. They wouldn't have even begun to perform these surgeries unless somebody just took it on themselves to do it, and the first ones were pretty crude. They've become extraordinarily good, and based not on perfect scientific rigor, but just the anecdotal reports of people who say "I need this".
The science helps rule out quackery, which is absolutely critical. There are things that obviously don't work, and the people who sell it know that they don't (or are deliberately avoiding learning). But even a lot of real medicine is less simplistically scientific than we'd like to believe.