Remove main.js requirement for themes

This is for #8626.
Checking `isTheme` first will completely skip checking the file system if the extension is a theme.