Do all stems have the same stack height for the steerer tube clamp? Does the height of the steerer tube clamp differ between stems, or is there one standard height used on all modern mountain bike stems? In my particular case I want to replace the stem on a mountain bike with a shorter one, but can I pick any other threadless stem and have it fight right on without needing any more/less spacers etc.?
No, the clamp that mounts to the steerer is not a standard height. There will be slight differences in the stack height of the clamp itself between different makes and models of stems that can typically be accommodated for with addition or subtraction of a small number of spacers, or the difference may be so slight that you don't have to change your spacers at all.
Spacers are cheap so don't sweat it. The only situation where you could run into trouble is if you have no spacers and a steerer that is already nearly too short and you move to a stem with a taller steerer clamp (stack height). Doesn't sound like that's an issue in your case, though.