In the derivation of results for an ideal gas, it is common to calculate the classical partition function for a single particle in a box. This can be done using the Boltzmann factor and integrating over phase space.
$$ Z_1 =\int e^{-\beta E(\{\vec{p},\vec{q}\} )} \frac{d^3p d^3r}{(2\pi\hbar)^3} $$
$$ Z_1 = V \left( \sqrt{\frac{k_BTm}{2\pi\hbar^2}} \right)^3 $$
Now, it is seen that that $Z_1$ can be written as $$ Z_1 = \frac{V}{\lambda^3} $$ where $\lambda = \sqrt{\frac{2\pi\hbar^2}{k_BTm}}$ is the thermal de Broglie wavelength of the particle.
This implies that we might interpret the single particle partition function as the total number of states of a particle in a box. Is it just a happy coincidence that the partition function corresponds to counting the total number states a free classical particle can take inside the box? What are some ways of motivating/explaining this?
I have seen an argument that goes as strictly the free particle in a box has no potential energy so the Boltzmann factor should be equal to $e^0=1$. Hence, the partition function according to its definition $Z = \sum_i e^{\beta E_i}$ should just count the total number of microstates. However, this doesn't seem convincing to me since why then would it have been valid for us to use the translational kinetic energy in the Boltzmann factor in our phase space derivation?