Refactored cyclic dependency handling

since https://github.com/pantsbuild/pants/issues/670 was fixed we got a regression. refactored cyclic dependencies handling to handle 1 level cyclic dependencies.

Testing Done:
tests are passing + tested on a project manually

Reviewed at https://rbcommons.com/s/twitter/r/1311/