Perplexing claim in Chang and Overby's "General Chemistry"
The  other answer is, I think excellent.

Your question is basically "but what if there isn't a direct proportion between number of gas molecules and volume?" Instead, that was Avogadro's hypothesis in a nutshell: the volume of the gas is determined exactly proportionate to the number of molecules in it.

You are right in principal that you could have such a "false law" where the number of molecules is inversely proportionate to the volume and still have equal number of molecules for $\ce{H2}$ and $\ce{N2}$.

Let's follow your course of logic. That would mean if I get 10 L of $\ce{H2}$, I would then have $k/10$ molecules. Let's imagine I add more and more volume, to get 100 L then 1000 L of gas. At some point, I must necessarily divide the molecules in fractions in your false law. Certainly a molecule must occupy some indivisible volume, since Avogadro believed in the atomistic theory.

Instead, the obvious solution is that the number of molecules must be a measure of the amount of "stuff." So if we have more "stuff," we need more volume for it to occupy. The expression must be directly proportional between the volume and the number of molecules.