I know it’s wrong to force a mentally ill person to compare their suffering to others. When I tell my doctor how horrible my mental health is, what the symptoms are, and they tell me to “think about the casualties of war in Iran”, I feel horrible. I would never ever do this to a person who’s suffering from mental illness. They probably already have enough on their plate as it is, and shoving the problems of the world in their face at that moment doesn’t help anybody. Is that it? I’d appreciate your input on how to verbalize, as pedagogically as possible, why it is wrong, or why it can be wrong.

It’s wrong because it’s simply irrelevant. Would it change anything about your situation if you did have it worse than everyone else (other than not getting comments like this)? I presume not. You’re still suffering, full stop, and that’s something that should be alleviated.
There will always be someone who has it worse. So the war casualties in Iran allegedly have it worse. First off, do they really? Some might argue that prolonged suffering is worse than a sudden death via a missile. But even without that opinion, there are people who have it worse than the Iran war casualties. You could be stuck in North Korea sentenced to a lifetime of hard labor and have terrible back pain making every hour of that hard labor torture. Does that mean the casualties of the war in Iran aren’t relevant anymore? I’m pretty sure just about everyone would answer no.
That second portion really sheds light on how meaningless it is for a health care provider so say something like that to someone like me in this kind of situation. Naturally, there are people that relatively suffer more than me. But, as you said, it doesn’t change to fact that I’m having a meeting with the doctor because right here, right now, I need help. Thanks!
Glad it helped. I’ll add that a healthcare provider should not be saying that, although I’ve experienced similar things myself, unfortunately.
Kudos to you for doing what you need to do for your mental health. I know it isn’t easy. Don’t let them talk you out of what you need.
EDIT: there was also an interesting quote I saw around here a couple of months ago. If you’re drowning, it doesn’t matter if you’re 10 m or 100 m underwater, you’re still drowning.