The short answer is you are correct. Nodes are just a function of barrel harmonics. You can think of guitar strings as a good example of this. To change the pitch of a guitar string you absolutely do shorten them via pinching the string against the fret with your finger. Shorter or longer strings have differing harmonics.
However, how is it then that a guitar with 5 strings, all of the same length, end up playing 5 independent notes on each of those strings? In this case the thicker strings have a different harmonic frequency than the thinner (they are lower). So how does this apply to a barrel?
Well, length is obvious, but so is thickness of the barrel, profile of the barrel, any added barrel device, a suppressor or not, and if you are talking about a semi auto then you have to include the gas block and gas tube as they are harmonically tied to the barrel as well. BUT, not just the size of the gas block, but the position of it on the barrel also impacts things...so does the inclusion of a front sight post, or the exclusion of it. Do you have a bayonet lug or not?
Basically anything physically touching the barrel will also impact the harmonics as well. Length is just one of many factors.