We do it in maybe two places, AnyObjectId for example has to support hex formatting, and here.  I think I just inlined it here because packet formatting should be reasonably efficient, and ObjectId formatting is already quite specific to the 20 byte format making it harder to handle the 16 bits used here by a pkt-line.

RawParseUtils has some decode functions for hex parsing.  We might be able to move the hex formatting to a RawFormatUtils or something.  Hasn't been a high priority, we don't poke this code that often to care enough about the potential duplication.