@just me some thoughts to explore this topic.
I prefer to think about mental health rather than mental illness, because it emphasises that there is a spectrum of possibilities, just as there is for physical health. For example, I haven't got too much exercise during the lockdowns and I'm a bit unfit, so to that extent I'm not completely healthy, but I'm not ill. I think it's the same with mental health - there are a range of states I can be in that are not completely healthy, but I'm not ill.
Now as we move along the spectrum from more health to less healthy mental states, there comes a point where someone can't function properly. It's pretty fuzzy where this point lies, but right down the far end it's obvious because there are people who are delusional, dangerous and violent, or people who can't take care of themselves and are a danger to themselves. All these extreme problems are definitely mental illnesses.
The point on the spectrum where we start to talk about someone being mentally ill is very interesting. By what yardstick do we measure that? Is it when they can't function properly in society? But that's a real minefield because different societies have different yardsticks. The Soviets were notorious for treating people who disagreed with communism as mentally ill, for example, and there's something similar apparently going on more subtly in China today. We'd probably think of most of these people as heroesand champions of freedom in the West. We get the same in small social groups - how many introverted children have been unfairly treated as bordering on mental illness by their very extraverted families? Being different from the prevailing social culture around you can be very stressful, even as an adult, and that can certainly lead to poor mental health, and this aggravates the social disconnect still further. As
@slant says, when that social disconnect happens in childhood we adapt in ways that become hard-wired - in adulthood, we can't just unwire these adaptations and it causes a lot of mental distress. At the very least such people are mental unhealthy even when they aren't ill with it. The same problem can come about through trauma as well, and there are many other causes.
In the end I suspect that there is always a relationship between the physical and the mental when looking at human condition. For example ... the example I gave above where a child is temperamentally different from their family and school fellows, and is a social misfit - and becomes mentally unhealthy as a result. Or a child is abused by a relative and has a lifelong trauma buried deep. Or an elderly person gets arthritis and becomes depressed because of the pain, and their inability to do the things they enjoy. I suspect that there are physical causes related to all mental health problems, some of them caused by hidden chemical imbalances perhaps as seems to be the case with my wife. It goes in circles too, because a lack of mental health leads very often to deteriorating physical health in all sorts of ways and there is a destructive cycle on both fronts for many folks.
I don't think that people who are simply mentally unhealthy are helped by being labelled mentally ill, any more than someone physically very unfit, or sporting a strained shoulder, should be labelled physically ill. In my experience there are significant risks in a person being told they have a named mental illness because the naming can conjure a demon - that demon binds itself all to often to someone's identity like a vampire and eventually they can't get rid of it without feeling a loss of their identity. It's hard to let go of the idea that 'I am a depressive', or 'I am neurotic' etc once this has happened because we have invested so much into it. It's necessary for medics to use these terms because they relate to treatments and provide continuity of care through patient records - but they come with significant risks to patients in my opinion because they are so hard to disengage from once we have bound ourselves to them.