consider 2 ideal harmonic notes with a frequency ratio of 3:2, say 3kHz and 2kHz ... The brain / algorithm must doubt between interpreting the collection of frequency peaks at m * 3kHz, and n * 2kHz as either (occasionally overlapping) harmonics of 2 notes at 2kHz and 3kHz, OR it could interpret this as harmonics of a single note at 1kHz (as you say the GCD of the frequencies).
There is inherent ambiguity between interpreting as 2 notes of each a timbre, vs interpreting as 1 note with another timbre...
One could physically construct 3 bowed strings with modekilling on the 1kHz string, such that these could make perceptually identical sounds whether the 2kHz and 3kHz strings are played simultaneously vs the 1kHz string.
at that point from the sound alone one can not discern in an ABX test which is the case, neither a human brain nor any algorithm. The doubt forces to guess (deterministically or not).
The sound is a projection of properties occuring in reality, and loses information.
The pitch is higher level than purely perceptual.
in the case of bowed strings mode-locking ensures the phases of all the harmmonics are reset each cycle (the bow sticks and slips), so that bowed instruments can be played harmonically to parts per billion.
since a lot of sounds are plucking we must be tolerant for frequency dependent propagations speeds in regular strings / media
Assuming we agree that "illusion" merely means mismatch between interpretation and reality.
https://en.wikipedia.org/wiki/Frequency_mixer
It doesn't quite work that way with audio but the effects are close enough.
an lower frequenncy sinusoidally amplitude modulated higher frequency sinusoid can be indistinguishable from 2 constant amplitude sinusoids at the sum and difference of the frequencies.
see an article by Plomp and Leveldt for the determination of the bandwidth of the auditory frequency bins (or filter bank)
Pitch can’t be termed an illusion, because it is a perception, not a fact of physics. So it is either always an illusion or never an illusion.
Frequency is a fact in the realm of physics. Pitch is something our mind labels things.
That's why it's widely accepted to be an illusion that arises in the brain's auditory center.