In case someone else is also confused by this, it seems that instanceof checks whether the objects prototype matches, and these prototypes are not shared across different contexts, which iframes are [0]. (Though I would still like to know why it works like this.)
[0] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...