This is spun-off from T233676, where this was previously considered. At the time it was blocked on other changes and thus taken out of that sprint in favour of other improvements.
The mediawiki.page.startup is a fairly simple module. It exists for internal use, is never depended on, implements a few miscellanous core contracts. Specifically:
- Enforce the security feature as configured by OutputPage::getFrameOptions (via mw.config wgBreakFrames).
- Fire the wikipage.diff hook as needed.
- Fire the wikipage.content hook as needed.
This can't be lazy-loaded and also isn't limited to a unique user context. Far from it, it's loaded unconditionally on all page views. This means it can either go into an exisiting (small) narrow deliverable that we can effort to load more widely, or into an existing deliverable that has the same needs.
Most obvious seems its sibling, mediawiki.page.ready. In fact, these once were the same module long ago, but were split as a micro-optimisation for what was once the "synchronous top queue" (where startup.js was in the sync top, and ready.js in the async bottom).