According to Wikipedia, a freehub is a kind of hub that includes a ratchet mechanism, so freehub is a subset of hubs. What you describe as the hub is in fact just the hub body.
The part of the hub on which the cassette is mounted is the freehub body. Depending on the brands, you can mount only one kind of freehub body, or several ones.
Shimano obviously considers their products as "families" and only make variations of their components to fit within the specs of the product family. The M7100 family only uses cassettes with Microspline freehub bodies, so is only offered with Microspline.
Specialized wheel manufacturers (Mavic, Fulcrum, DT Swiss,...) are usually more flexible and design their freehubs so that one can fit different kinds of freehub bodies. You can typically buy the wheel with HG or XD, and change afterwards.
You'll find an example here of the exploded view of a Mavic freehub, illustrated with HG and XDR bodies. It is a hub with sealed bearings. So everything can be removed from the hub body, if a part needs to be replaced. That's also true for cup-and-cones hubs, with one nuance: the bearing cup is a part of the hub body. So if the cup is worn/damaged, the hub body needs to be replaced.
Then the question of the freehub bodies is mentioned on several answers, so I'll only describe it shortly, for reference:
- HG/Hyperglide/Shimano: most common one, up to 10-speed road cassettes) (road), or 12-speed MTB ones (MTB - there'sthere's an overhang of the large sprocket in that case)
- HG11, HG Road: similar to HG, but a bit longer, to accomodate 11-speed+ road cassettes (or MTB with spacer).
- XD (from SRAM): first freehub body that can accomodate 10-teeth cassettes (and even 9-teeth).
- XDR: long version of the XD, for 11/12-speed road cassettes (or MTB with spacer).
- Microspline: Shimano's answer to XD.
- Campagnolo ED: basic Campagnolo body (9-12-speed cassettes)
- Campagnolo N3W: Campagnolo's answer to XDR