Hmm... I didn't know that is called topological sort. I had something like that idea, but it seemed very complicated to implement.
As there seems some examples and implementations of topological sort, it is not so difficult to replace the implementation of `OverrideOrderCalculator`.
Let me know good libraries of topological sort if you know proper ones.