While it is possible to get e.g. situational depression from being stuck in a bad job, etc., long term and chronic conditions are often hardwired in the brain. People with serious chronic depression, they're not depressed because of their current life circumstances, they often had a perfectly fine family, etc., their brain is just not producing the serotonin physically or whichever hormone it was.
ADHD - again, the brain structurally has issues with focus and executive function.
Autism - brain just structurally hardwired differently from birth.
Tourette's - thought to be to do with neurotransmitters in the part of the brain that controls movement.
People with mental illnesses or neurological disabilities, their brain is generally literally physically different, that's why it's so hard to recover by yourself from a mental illness without external help in the form of e.g. therapy. And if people have, say, depression bad enough they may need to be on e.g. antidepressants for life *while also* going to therapy regularly, in order to keep the condition under control.
Can people get mental illnesses from life circumstances? Yes, as in the case of PTSD, but after someone has PTSD their brain again has physically changed from how it was before they had PTSD.
If someone has a *mild* version of a condition, they may well be able to cope with the lower amount of symptoms they show without outside assistance. But the existence of the milder versions doesn't stop the more severe versions from existing. One person with ADHD might be a bit scatterbrained but overall manage to be successful, whereas another might be completely unable to focus on one thing long enough to study or hold a job, while also living in a mess because they can't manage their chores either. Just because the first person is doing ok doesn't mean the second person wouldn't benefit from meds.
Actually, the first person may also benefit from treatment even if they seem to be functional, because perhaps they're succeeding at their job but every other part of their life is slowly spiralling out of control and they only manage their social life and their household chores because their spouse has taken on the role of reminding them to do things all the time.
Personally, with my Tourette's, I'm fortunate that when on meds, the tics are reduced enough that with effort I can appear for up to a few hours at a time to not be disabled, so I get the choice as to whether to tell people about it if I'm not going to be around them for that long at once. But back before I was on meds, I would get tics every 5-10 seconds and they would be extremely obvious ones too, so I ended up having to go around being a public service announcement for how Tourette's works because everyone would ask me about it. And if I hadn't gone on meds I imagine I would have had more trouble getting work, especially in the present era when the fashionable thing to do is have open-plan offices.
But yes, overall, mental illnesses and neurodivergencies are very real disabilities, and just because someone appears to be functioning, doesn't mean they're suddenly not disabled, that they just need to try harder, that if they (changed their diet / took up a particular exercise routine / changed job / applied more willpower / whatever) then they would no longer have any symptoms. These things are real and they require proper medical treatment just as much as physical conditions do.