But there is another side that confuses me. The headphones are tuned to a standardised dummy head. If you replace this dummy head with a head like mine, the measured frequency response of the room would be different and the headphones would have to be tuned differently.
because the headphones response has to match the measured room response (with the head) to sound neutral. Otherwise, I'm basically hearing through someone else's ears, right?
@Hasan Aydin your intuition is correct. The "standard" HRTF curve is averaged over thousands of people and it has significant individual variation. Essentially this is a boost of 12 dB or more in the 2-5 kHz range but the curve is more complex than that. And there are different HRTF target curves. When we wear headphones, they play music directly into our ears which bypasses most of the HRTF effects, so their frequency response must reproduce the HRTF that they bypassed. This is one reason why people argue so much about which headphones sound best - everyone has a different HRTF and the world literally sounds different to them. And it's a key reason why headphones are different from speakers, which don't bypass our HRTF, so with a speaker, "flat" response is ideal for everyone.
Regarding your question about the ear canal, that is a contributing factor but there are many others: the distance between your ears, the size of your head, the density of your skull and nasal cavities, the size & shape of your ears, etc. all contribute to individual HRTF.
For example most headphones sound brighter than reality to me, especially ones that follow the Harman curve, so I know my personal HRTF has a smaller hump in the 2-5 kHz range than most other people. If I apply Oratory1990's EQ to headphones, they sound too bassy & too bright, like a teenager got his hands on a graphic equalizer and pumped up a "V" shaped curve. That's not to disparage his work, which brings a measure of objectivity and consistency to a subjective and inconsistent field, which is great.