It's primarily about velocity and stability.

My "old" school of thought dictates that any caliber up to the 30-06 case family will thrive very well in barrels between 20" - 22" and magnums (i.e. .300 WM, etc.) do their best work out of barrels in the neighborhood of 24".
Please don't think me rude, but my experience and chornograph will disagree with your school of thought. I have personally chonographed even cases as small as the 22 hornet and even with 10 grains of powder I was able to achieve higher velocities in a 22" barrel than I did in my 18" barrel. I'm not saying that all barrels should be overly long, and of course there is a point where the extra velocity per inch tapers off considerably with more length. The length is of course dependant on case volume as you noted.

I think the main key is the rifle's intended use. When I lived and hunted in the Appalachain Mountains of Northeast Georgia I carried a 16" barrel carbine and loved it! Hunting in the open prarie of Wyoming I use a 28" barrel 25-06 for Antelope and in the mountains a 26" barrel 338WM for Elk. For benchrest shooting I like a 26"-28" for smaller cartridges and a 28"-32" barrel for magnums. The best long range gun I ever had was a 32" barrel 338 that would give me a solid 300fps better velocity over the same exact loads in my 26" hunting rifle. BUT, I didn't have to lug that 22 pound rifle through the woods hunting deer