The apis used to control focus should just be put behind a permission, as microphone/camera access etc. are. If a site wants to control window focus, I should have to explicitly allow it.
AFAIU, the way modern implementations work, is that they make some link (occasionally the entire body) a target=_blank link, which points to some other part of the website. This causes the link target to appear in a new tab. Now, the original tab has its contents changed to that of an ad; when the user finishes browsing the website and closes the newly-opened tab, they will see the "pop-under" tab (which is actually the original tab the user entered the website with).