Register NS_SCHEMA early if running on schema wiki

The point at which $wgExtensionFunctions are executed is too late for
registering additional namespaces. Defering the registration of the namespace
until then can lead to unpredictable results, as documented in bug 45031. The
solution is to register the namespace early by binding the CanonicalNamespaces
hook handler at file scope and checking there if the wiki should activate the
extra namespace or not. Namespace permissions and content handlers can be
configured at unconditionally at file level since they do not require the
namespace to actually be created.

Bug: 45031
Change-Id: Ide5f0920632b758e769c0b6f32d8231eeaf7a1d4
Merge "Register NS_SCHEMA early if running on schema wiki"