Fix #1544 (SO in dependencies extraction with macros and name hashing)

This PR addresses these bugs :
 * #1237 
 * #1408 
 * #1544 

The fix that was applied to `compile/interface/src/main/scala/xsbt/Dependency.scala` was unfortunately not sufficient, and sbt could still recurse infinitely over some nodes that had a cyclic chain of original-expanded trees.

To fix this problem, I ported the fix that was applied to `compile/interface/src/main/scala/xsbt/ExtractUsedNames.scala`, which required me to slightly change how dependencies are extracted, so that we can perform a more aggressive filter on nodes that we have already inspected.
Here we need to keep only the children that are not equal to the node that we are inspecting.

Imagine a macro expansion `#1` that had an original tree `#1`. This problem was successfully solved by the previous fix, because we had `#1 == #1`, and we wouldn't inspect the original tree any further.

Imagine now a macro expansion `#1` that had an original tree `#2`, that had an original tree `#1`. With the previous fix, we have `#1 != #2`, so we start `traverse`-ing `#2`, and we have no reference to `#1` in scope, which means that we won't be able to detect it if we end up inspecting it again (which will happen, since the original of `#2` is `#1`).

Using this fix, when we see that `#1` has an original tree `#2`, we filter out all the subtrees of `#2` that are equal to `#1`, and we don't end up looping over the same part of the tree.

I hope this is clearer.