If a pilot fantasizes about crashing planes and killing people, and tells someone about this, I'm not sure I want there to be a way for them to keep their career. Sure lets treat them, get them better, but putting them back in a plane? Is it worth the risk?
You put people like that back in planes, and well, eventually one got the keys that shouldn't have. I can imagine TV reporting after a suicide crash "well... we knew they used to fantasize about crashing planes full of people, but they said they were better now and we didn't want to damage their career so we put them back in the captains seat". Help them, retrain them for another job, but don't give them the keys to the plane.
In real life I keep reading about an increase in "near collisions" on runways caused by low performing air traffic controllers that keep getting shuffled around instead of being fired (having their career harmed).
If people with known mental issues can't get guns, why would we give them the keys to a large airplane full of people?