How is a URL getting mapped to a page template

I have done something similar by adding a rewrite rule

add_rewrite_rule( "users", "index.php?fea_users", 'top');
add_filter( 'query_vars', array($this, 'query_vars') );
add_filter( 'template_include', array($this, 'template_include'), 1, 1 );
function query_vars( $query_vars ) {
    $query_vars[] = "fea_users";
    return $query_vars;
}
function template_include( $template ) {
    global $wp_query;

    if ( isset($wp_query->query["fea_users"]) ) {
        // return any php file here
        return $this->common->get_template( 'page-template.php' );
    }

    return $template;
}

I have a url looking like www.mydomain.com/users and the actual code is located in page-template.php

Another method, after your updated post, Is to create a normal page and associate it with a custom template. The page itself doesn’t need any content, it’s only there for the slug (permalink), it’s associated php file can display anything.