**Homebrew it.  That's the D&D Way.**

You are in fact describing an old D&D trope, made popular in the [Curse of the Azure Bonds][1] (computer game, adventure module, and novel) back in 1989. In AD&D 2e module FRC2 Curse of the Azure Bonds, PCs get these magical tattoos put on them that force their actions, and the campaign is about their attempt to escape them.

The rules for the bonds span 3 pages in the module, but as for removing them:

> Dispel magic and remove curse will
never have any effect on the brands,
except to bring about the results mentioned
above. A limited wish spell (if successfully
cast without the death of the
magic-user) will remove one of the
marks from one individual. A full wish
spell will remove up to three of the
marks. Short of these actions, the Azure
Bonds will prove extremely difficult to
delete. Attempting to cut off the arm and
regenerating it through magic will result
in the brands merely reappearing on the
new limb.

Anyway, if you don't want them removable by the rules, make up a new thing that someone has just created. This still leverages the rules framework, but specifies what works and what doesn't.  This is basic homebrew content generation expected of any DM, and first party published adventures, monsters, etc. don't hesitate to say "well this is a curse but..." when needed.

  [1]: https://en.wikipedia.org/wiki/Curse_of_the_Azure_Bonds