Did I miss something somewhere? Where is this useful information for me that gives me a clear and precise answer? Why do I hear a difference in sound quality when changing codec? I don't see the answer to this question?
There cannot be a clear and precise answer so long as we cannot exclude your brain tricking you as the cause of your feelings.
You asked if it is the only possibility, and it isn’t, but it’s one of them and thinking you really hear a change when fully aware of the codec setting, sadly that does not remove the possibility of expectation bias. A diagnostic about sound change should start by making sure it exists. It’s not the easiest thing to test but it’s a reasonable first step and for sure, one of the possibilities that should be taken seriously until it it disproved.
I would also add, you can set a change on your source but the headphone does something else. Like some sources have more codec options than the headphone but won’t tell you when it’s not accepted(they just fall back on a more universal codec while showing whatever you picked still highlighted in the selection).
Or if the quality of the connection is bad, the source can fall back on either a lower rate for the selected codec, or a different codec(and lower rate).
And back again to bias, there could be a difference in delay when using a certain codec that gives your brain another evidence of change, or a sound when the internal dac changes sample rate, which in turn could be enough to experience other differences in sound that don’t have to exist. Your brain only need a lead on what’s playing and the idea that something is really different somewhere, not necessarily how and where you feel it’s different.
It could be that the conversion between your file and some codecs are audible in some cases and not others.
It could be that you went full audiophile on your description and talked about dynamic and what not when it’s just not what you felt. Maybe you don’t even have a clear idea of what dynamic compression can sound like(people tend to bring that up for everything, from DACs to format resolutions, but what they describe is often something else and sometimes even the opposite of what dynamic compression does subjectively). This scenario could involve sound differences you’re really hearing because while fairly transparent, few codecs(if any) are entirely faultless under all conditions with all files.
It could be that the headphone messes up for a particular codec, it’s rare nowadays, but in the elite audiophile world, it’s often 20 years ago somewhere.