Could be pretty simple - there might be a better way but maybe something like this:
- Added menu item at bottom:

- If the first criterion chosen is granular (is NOT a group like colour tag) then the "Then sort by" menu item would be disabled.
- That would mean the only when one of the following items is chosen in the top group, that the "Then sort by" menu item would be enabled:
- Type (A-Z)
- Type (Z-A)
- Colour Tag
- Media Resolution
- Reselecting a new menu item in the top group would reset and 'blank' the 2nd criterion
In short, select a top group item and it sorts by that criterion (as is already). If I want a 2nd level sort, I just go back to the sort icon, choose the "Then sort by" menu item and then the 2nd criteria I want. To clear it I just choose a top level group criterion again.
That's probably the easiest way without larger reworking of the entire UI presentation for sorting.
I realise this is a private 'for profit' project, but I've got a bit of time on my hands - if you wanted to give me access to the repo I could always add it myself and do a pull request for you, no strings -
https://au.linkedin.com/in/paulsorauer
Thoughts?
Cheers,
Paul