For most people it's a coping mechanism. Having or experiencing the things you listed and many others sucks, and making light of your own symptoms in situations that are uncomfortable to adress head on can make things easier to process and make you feel a bit more normalized or relatable, some say it helps them feel more like an actual person in social situations than the stereotype people feel about many mental illnesses. It also helps when you have to repeatedly explain your symptoms to people, especially people who should know already, even with treatment I still have these issues and I most definitely do not have the energy to seriously explain my symptoms and it takes much less energy to make a quick light hearted statement or joke. Many people would struggle more without this as a coping mechanism. There are most definitely ways it can be harmful, though. For example self deprecating jokes about your condition or your mental state, jokes about attempting suicide or self harm, and using jokes to deflect the idea of seeking help can make your mental state worse and make it feel harder to seek help as well as actually hurt others like loved ones or those with the same conditions who may also internalize self deprecating humor. People should still be mindful of How they joke about themselves and about their conditions. Someone making a joke or being light hearted about their conditions does not mean that they are not suffering or are suffering less from them or that anyone should take them or their symptoms any less seriously, it also doesn't necessarily mean that they themselves take their condition less seriously and thos assumptions can also be harmful.