HookContainer::salvage() expects to be called immediately after the
object is constructed, and I enforced this expectation by asserting that
$this->handlersByName is empty.
However, MediaWikiServices::resetGlobalInstance() calls
HookContainer::run() in between construction and salvage(). The effect
is that the assertion is hit if any hooks were executed using the old
HookContainer.
So, call onMediaWikiServices() using the old pre-reset HookContainer,
instead of using a partially-constructed HookContainer for this purpose.
Pass the new MediaWikiServices instance as the argument, since that is
the thing that the hook is configuring.
Bug: T263925
Change-Id: I2b462d82c82314b11563a5ba1f02c6fb6d29e608