There's no checking for what action is rendering the page (or if it's the page or something related to the page) in onOutputPageBeforeHTML, so the subpage toc is slapped on everything - view, edit, history, etc. Anything that isn't actually a separate page (related special page).
We need some way to check this