It looks like this is only getting the children of a given rule. If that is true, can you see if the existing function already works, and gives what you want:
```
$rule_operator->get_rules(language, parent_id);
```
If you put the rule id of a rule/category in the above function as a parent_id then you get all the children of that rule/category.