This is a bit of "future-proofing". At the time of writing, there was nothing in the game that could alter your number of hit dice, but this ensures the rules are already in place if something should be introduced later that does so.
The only example I can think of off the top of my head is in Eberron: Rising from the Last War as an optional rule attached to the Aberrant Dragonmark feat.
Option: Greater Aberrant Powers
At the DM's option, a character who has the Aberrant Dragonmark feat has a chance of manifesting greater power. Upon reaching 10th level, such a character has a 10 percent chance of gaining an epic boon [...] If the character gains a boon, the DM chooses it or
determines it randomly. The character also permanently loses one of their Hit Dice, and their hit point maximum is reduced by an amount equal to a roll of that die plus their Constitution modifier (minimum reduction of 1). This reduction can't be reversed by any means.
A DM could also create a curse, poison, or disease that reduces a character's hit dice until it's removed, or invent a boon, blessing, or magic item that grants additional hit dice. In either case, this rule already covers how that would affect the character.