Confusion about how a URL is being parsed

WordPress uses set of regular expressions to parse urls (so called rewrite rules). It matches them in some order and stops when first matching rule is found.

It’s a little bit hard to say what rule is matched in your case. We don’t know what are your permalink settings and what other changes to rewrite rules are made.

To see all these rules, just add this function and then call it (footer.php is a good place to put its call)

function my_debug_rewrite_rules() {
    global $wp_rewrite;
    echo '<div>';
    if ( !empty( $wp_rewrite->rules ) ) {
        echo '<table><thead><tr><th>Rule</th><th>Rewrite</th></tr></thead><tbody>';
        foreach ( $wp_rewrite->rules as $name=>$value ) {
            echo '<tr><td>'. esc_html($name) .'</td><td>'. esc_html($value) .'</td></tr>';
        }
        echo '</tbody></table>';
    }
    echo '</div>';
}

Another thing you can check is which of these rules has been matched:

function debug_page_request() {
    global $wp, $template;
    echo '<p>Request: '. esc_html($wp->request) .'</p>';
    echo '<p>Matched Rewrite Rules: '. esc_html($wp->matched_rule) .'</p>';
    echo '<p>Loaded Template: '. esc_html(basename($template)) .'</p>';
}

(Again, call it in footer.php).