Only cache module_directories once settings are initialized
Calling module_directories before settings are initialized (and therefore
before the modulepath is known) returns an empty array. We probably don't want
to cache this, and it might interfere with loading from the modulepath once it
is initialized.