Can I replace a 9spd freehub with a 7spd one?
As you suspected, you may not run a 7 speed free hub with a 9 speed hub shell.  You will need a new 9 speed free hub, and continue to use the spacer ass you have been.

Hubs are not generically sized.  Each model is sized for the number of gears it is expected to work with.  Replacing the freehub will mess with your dropout spacing, or the position of the gears in relation to the wheel, or both.  It can also prevent the bearing adjustment from working properly.