(maint) Log invalid modules

Give notice when a module on the modulepath is invalid, explaining why.
To do this cleanly, we stop trying to add "." and ".." as modules since
these are always invalid.
(maint) Avoid checking for strings in module_references

module_references contains Hashes so there is no need to look for
strings within it, especially when the next line does what this one was
supposed to do.