Core associates tag extensions with a particular Parser instance. That's probably *too* fine-grained.
Parsoid associates extension modules with a SiteConfig. That may be too coarse-grained -- perhaps an extension would like to register a new tag, but only for recursive parses inside its own tag, like:
vanilla wikitext <my-tag-extension> this is ''also'' wikitext, but in here <this-new-tag>works</this-new-tag>! </my-tag-extension>
That would push extension registration all the way into the parseOpts passed to wikitextToDOM. That might be too far.
*Anyway*, in the short term we can just add a method to unregister extension modules in the SiteConfig. Then callers who want to temporarily register an extension (for example, in a test case) have a way to clean up after themselves. (Alternatively the test case could replace the ParsoidSiteConfig service to substitute their own SiteConfig and throw it away afterward?) Longer term we should figure out if extension registration should move from SiteConfig -- perhaps a one-time registration can stay at top-level but there's a way to enable/disable registered extensions on a finer-grained basis.