Peru does something to force healthcare providers to cover transgender procedures and treatments, people are outraged that it's been labelled an illness. You can't make this stuff up.
I'm not sure that's what the criticism is about. The law references ego-dystonic sexual orientation as one of the "mental illnesses" it covers. From Wikipedia (edits mine):
Ego-dystonic sexual orientation is a highly controversial mental health diagnosis that was included in the Diagnostic and Statistical Manual of Mental Disorders (DSM) from 1980 to 1987 and in the International Classification of Diseases (ICD) from 1990 to 2019. Individuals could be diagnosed with ego-dystonic sexual orientation if their sexual orientation or attractions were at odds with their idealized self-image. It describes a conflict between the sexual orientation a person wishes to have and their actual sexual orientation.
The addition constituted a political compromise between those who believed that homosexuality was a pathological condition and those who believed it was a normal variant of sexuality. Under pressure from mounting scientific evidence that the desire to be heterosexual is a common phase in a gay, lesbian, or bisexual person's identity development rather than a mental illness, the diagnosis was removed. Leading up to the ICD-11, a WHO-appointed working group recommended its deletion, due to a lack of clinical utility and the potential for negative consequences. The ICD-11 does not include any diagnostic categories that can be applied to people on the basis of sexual orientation, bringing the ICD in line with the DSM-5.
The current manuals for mental disorders (ICD-11, DSM-5) already include diagnostic categories that can be used as a basis for providing healthcare to LGBTIQ+ people (e g., gender dysphoria). The criticism of the Peruvian law is that it is based on outdated categories that regard the actual sexual identities and orientations as a whole as "mental illnesses" (rather than the affective and emotional issues that LGBTIQ+ are vulnerable to), which has no clinical value and is extremely prone to being used to discriminate against LGBTIQ+ people.
Yeah, the problem is "do no harm". To modify your body, a medical professional needs to be fixing something, i.e. you have an illness that needs treatment.
So... you are under the bizarre (and very wrong) impression that doctors in other countries only give gender-affirming care to people they have determined have an illness?
The way other countries do it is by considering "gender dysphoria" an illness. This way, you aren't ill for being trans, but you can absolutely feel sick if you're trans but cannot transition, so the cure for gender dysphoria is to facilitate medical transitioning.