It’s not a mental illness. If anything, it’s a mental disorder
Those are the same thing. "A mental disorder, also referred to as a mental illness, a mental health condition, or a psychiatric disability"
Most mental illnesses can be successfully treated, many live to tell the tale. Drug addicts who become treated are no longer addicts, sufferers of emotional cognitive disorders who become successfully treated are no longer emotionally suffering. Some disorders are treatment resistant, and afflicted individuals undergo life-long consistent maintenance therapy.
A sexual preference towards men, women, or nonbinary isn't a mental illness. A sexual preference to children is.