While you’ve found the problem already, here is some basic code to move a specific rule to the end of the rewrite rules with the rewrite_rules_array filter for people stumbling across a similar problem.
Say I want to move the rule for ([^/]*)/([^/]*)/?$
:
add_filter("rewrite_rules_array", function($rules) {
$keys = array_keys($rules);
foreach($keys as $rule) {
if($rule == '([^/]*)/([^/]*)/?$') {
$value = $rules[$rule];
unset($rules[$rule]);
$rules[$rule] = $value;
break;
}
}
return $rules;
});
Note that you’ll need to flush/update the rules for this to have any effect. Saving your permalinks configuration in the backend is enough to accomplish that.