I think that's RAW actually, if you have any combat-capable NPCs traveling with the party they "get" an accursed share of the XP which is then destroyed.
For sure, though there are many things that aren’t as clear cut as a NPC.
Is a PC wearing a command amulet and shadowed by a Shield Guardian a party of two, or just one? What about a PC owning a Figurine of Wondrous Power? I think most people would say the latter is a party of one, with just a magic item involved, and yet the former case is roughly the same… but also feels maybe different

? The Figurine does not even require attunement by the way, so you could have a hundred of them…
And how about strategies for making a more sparing use of the Shield Guardian (so that it survives longer), such as leaving them in the previous room (to protect them from AoE, and still benefit from damage transference, but not the Shield reaction, nor their attacks). Does that count as a "NPC traveling with the group"? Kinda, but also not exactly…
Or even the most sparing use which would be to just have the Shield Guardian cast a concentration spell (using one of your own slots too!) and then stay parked further than 60 ft away from the fight, so that it doesn’t flunk its concentrarion save due to damage transference... that is basically the same as a NPC casting Bless on the party and wishing them luck at the entrance of the dragon’s lair and then promptly walking away. Does the caster (NPC or Shield Guardian) in this case get a share of the XP?