If you look at mental illness from a Buddhist perspective, I think the cause is excessive self-consciousness.
I think it's probably because they are too arrogant in Buddhist terms.
Arrogance is when you compare yourself to others and become complacent or depressed, and in the case of a state of mania, in terms of Buddhism, you feel that you are superior to others and can do anything, and you misunderstand and work hard beyond your abilities; in a state of depression, you assume that you are a bad person, and you are unable to move your mind and body. Both are in a state where their sense of self is too strong, they compare themselves too much with others and those around them, and things don't go well.
Self-consciousness (ignorance in Buddhist) is a source of affliction that is easily expressed in greed and anger. The root of the problem, like what I want or what I don't like, is ultimately a sense of who I am, a feeling of comparing myself to others. Self-consciousness is a state where 100% of the energy of the mind cannot be used and is wasted due to friction in terms of electricity or physics. Greed and anger are signs of that.
In Buddhism, even medicine blurs reality (makes you not feel pain), so I don't really recommend it, especially if you have a mental illness. When my heart is depressed, I think it's okay to just face my heart, stop comparing myself to others or assuming that it's useless, and start where I am now.
Healing one's own heart with one's own heart seems easy, but in reality, I also think it's difficult because I have to change my own mind.
I thought there would be no harm in knowing the heart, or rather the trick of self or arrogance, so I answered. I hope you feel at ease.