group to do this. I recommend doing this work in a secondary context-only group. For example,
group(main) using keys ... match > use(reorder) group(reorder) any(high-cantillation) any(vowel) > context(2) context(1) ...
You can even use recursive group processing to iteratively improve the order of the characters one swap at a time to reduce the rule set. It could be an interesting solution!
Note that you can simplify the logic somewhat by assuming that only the most recently entered character is out of order – trusting the keyboard to have reordered previous combinations at the time they were entered. This means that with judicious use of
stores you may be able to reduce this to one rule per character class.