I don't know any non removable D-Mod in Vanilla. During any playthrough i had accumulated tons of ships at the end and restored all of them when the colonies were rolling out enough cash. No D-Mod was persistant. Even all built in D-Mods can still be removed.
Built-in d-mods include Ill-Advised Modifications on Pather ships, Special Modifications on Executor and other LG ships. Venture-P has a built-in d-mod of some sort. Hull Restoration will not remove them but Restore will. Not a problem for cheap Pather frigates like the infamous Brawler-LP, but it is a huge cost on Executor (more than half a million).
20 million credits are not enough to Restore all of the few hundreds of ships I collect by endgame, and even if it was, I do not want to burn all of my balance on Restoring ships.
Executor is the major ship where I am better off looting the ship from enemy fleets instead of building my own, since I effectively pay twice (once for building it, another for Restore) for a pristine ship if I build it myself.