You can do this if you add a calculated field to the category object.
Call it "Parent Category" and add it to the category window.
Your calculation will be:
static def GetAttributeValue(Category):
Value = Category.Parent.Title
Set Calculation Type to scheduled and create a bulk action in schedule manager to update existing categories.
When done change the calculation type to "After Read" to update any new categories you add. The category window must have your new field and the Parent attribute showing and the calculation handler (OnValueChanged) for this needs to be added.
Your group query can then be created using your new "Parent Category" to group your results.