Pages should have priority when using add_rewrite_rule

If I understand you correctly, you could try to replace:

add_rewrite_rule( '^prefix-(.*)', 'foo/bar/index.php?page=$matces[1]', 'top' );

with

add_rewrite_rule( '^prefix-(.*)', 'foo/bar/index.php?page=$matces[1]', 'bottom' );

From the Codex:

top‘ will
take precedence over WordPress’s existing rules, where ‘bottom‘ will
check all other rules match first. Default: “bottom