The constructor of the Domain class does accept custom template or pattern arrays. However, the TemplateConfiguration and PatternConfiguration objects it creates use the default storage settings.
We may need to change these, for example when the Web2Cit-Server uses sandbox configuration files in the "User" namespace (we currently do this by changing the storage settings *after* the configuration objects have been created).
Consider having the constructor accept alternative (optional) storage settings.
This may also be related to T302588.