Fix incorrect CircularDependencyError

In the build_graph method of the MigrationLoader class the self.graph.root_nodes(...) method was run on a dependency graph that was not yet fully constructed. This could cause the current node (key) to be incorrectly included among the returned root nodes and since the parent is drawn from this set one could get circular dependencies not present in the real dependency graph.

Perhaps this change will fix the problems described in Django ticket #22325 and #22277.