Quarkonium polarization data, usually considered a difficult challenge for the QCD description of quarkonium production and relegated to an a posteriori test of predictions exclusively driven by cross-section measurements, with puzzling results, provide, in reality, the most fundamental, direct and model-independent connection to the production mechanisms. We have simultaneously fitted the ψ(2S) and ϒ(3S) differential cross sections and polarizations, reliably measured at the LHC up to higher transverse momentum pT values than ever before, as a superposition of colour-singlet and colour-octet contributions perturbatively calculated up to next-to-leading order. We show that, except for the lowest pT cross-section data, where factorization between short-distance and long-distance QCD effects is not expected to be applicable, all the measurements are very well reproduced. Besides providing a straightforward solution to the “quarkonium polarization puzzle”, our study shows that quarkonium production is dominated by the unpolarized S0[8]1 octet term, an observation that opens new paths towards the understanding of bound-state formation in QCD.