[Fix #1427] Exclude top level directories early

Based on an idea from @bquorning. I expect that this problem with large `vendor` directories could affect more people.

Take the excluded top level directories out of the equation altogether so that they are not searched for files. This is an optimization to speed up the target file search phase when there is, for example, a vendor directory with a lot of files in it (a top level vendor directory is excluded by default).
Guess this function could benefit from some top-level comment describing why it's implemented as it is. I'm pretty sure someone will wonder about this in the future. :-) Other than that - the code looks good.