Weak Dimensionality Dependence and Dominant Role of Ionic Fluctuations in the Charge-Density-Wave Transition of NbSe2