I have been participating in a discussion thread on a forum where a question was asked about how XP was divided up to include Hirelings.
Personally, I find this a ridiculous idea and said as much in the thread. Hirelings do not ever gain experience points or do they ever gain in levels. Ultimately, I think the justification the OP was using to give hirelings XP was a quote from the DMG on how division of XP goes to all surviving "characters".
Here I think that OP is taking far too loose interpretation of what a "character" is in the game. There are two types of "characters" really, a "Player Character" and a "Non-Player Character.
A "Player Character" is one that is operated and role played by the game participants, the "Player". "Player Characters" are able to gain full shares of treasure, experience points and to gain levels of experience.
A "Non-Player Character" is a character that is operated (usually) by the DM/GM and can be a Henchman, a Hireling, a "Monster" or anything the "Player Characters" come into contact with.
Often, the DM/GM will allow the Player to operate a Non-Player character such as a henchman if they think the Player can roleplay appropriately. It is well within the DM' s authority to operate and otherwise roleplay Henchmen and any other "Non-Player Characters".
The only "Non-Player Characters" which are able to gain XP and levels are Henchmen and they gain only half that of the Player Character they serve under.
Hirelings, even those purported to have a level such as soldier with rank, are paid labor only. They do not ever gain experience points or gain experience levels.
When the DMG makes reference to all surviving characters, it is referring to P"layer Characters" and Henchmen. Not anyone or anything else. A Henchman is singular because it is noted that should a "Player Character" die in game, a Henchman can be taken over and operated by the Player as a "full" Player Character" after that. No other "Non-Player Character" has that distinction.
"Monsters" that PC's combat or otherwise encounter, hirelings, etc.. that are operated by the DM/GM gain XP or levels. A Dragon or Hill Giant or Umber Hulk, etc.. gains no XP and levels if they defeat PC's during a game, regardless of how temporary or enduring they are.
The party in a campaign may encounter "Rohrstagg" the Storm Giant whose cavern in the Wenstrahm is encountered multiple times over a campaign. Every time the party is defeated and survivors, if any, are sent scrambling down the mountain, "Rohrstagg" the Storm giant gains no XP or levels. He is every bit as much an NPC as any Hireling.
Can the DM/GM decide that a Hireling that has been lucky enough to survive and contribute to an adventure or campaign may become a Henchman at some point? Absolutely, but they gain no XP or levels until they become a Henchman.
So there you have it, my take on why Hirelings can never, ever, as Hirelings, gain XP or levels.