Custom Page out of Wp Theme

i have this website running in WP and I had to create a feature to generate pages automatically and I did it through a separate WP backend, which creates the .php pages within the root of the site.

When I call domain/slug-of-page.php everything is ok.

But when I call the page without the extension (.php) the WP understands that it is an invalid url (404 error) because there is no page in the WP with that name.

I tried to insert the page created in the wp_posts table but when calling the page it loads the WP theme … I don’t want it to load the theme.

Is there a way to make the url friendly (without the extension) and not handled by the WP handler?

Thanks for every help.