Recursive Groupby in Lists stop working as expected

I imagine that could be technically quite difficult, given that the hierarchy is functionally unlimited in levels, so checking every ancestor branch could be prohibitively resource-intensive/time-consuming