Ok, I've found
this method by Liz Castro which does pretty much exactly what I described upthread.
She is recommending her method in the context of iBooks. I created an ePub using her method, sideloaded it into iBooks and the pop-up worked beautifully.
Unfortunately there was no such luck on other platforms. Kindle recognised my tags, but its implementation gave me a new page rather than a pop-up. Other platforms either just jumped to the target text or failed to recognise the tags at all.
Only iBooks hid the target text as intended.