Simplify some JS code hints filesystem traversals

This is a code cleanup pull request---made possible by the new filesystem architecture---which removes a few buggy  filesystem traversal functions. I've tried to make ONLY local changes and to preserve the semantic (more or less) of the previous functions. It will surprise no one to hear that I really have no idea what is going on around this code, but the unit tests still pass with the changes and everything seems to work fine for me...

This change is also important because, in the near future, `FileSystemEntry.visit` will be smart enough to not blindly follow cycles of symbolic links forever (see #5892), which the existing filesystem traversal functions in the JS hinter happily do.

CC @gruehle @peterflynn