MDL-37436 initial patch to allow $PATH-requires->js() to function when $CFG->themedir is set

This commit replicates the functionality of the check for $CFG->admin but for $CFG->themedir