I've worked at three airlines.
At two of them, pilots have acted irrationally in the cockpit and have been removed from flight status for psych issues.
It's tragic when it happens, but pilots are just as vulnerable to mental illness as anyone else....