I’m building a WordPress theme and noticed that the 404 page template runs along with the corresponding templates for each page. Any idea why?

I used the following function to retrieve the URLs of each page.

  function template_debug($filename = null) {
        $url = home_url($_SERVER['REQUEST_URI']);
        debug("Called from: $filename using URL $url \n");

Then I inspected the front page which triggered the 404 template along with the front-page template. The Network Monitor tab showed the error, which was an incorrect folder name included in the CSS file.

After making the necessary changes, the 404 template isn’t being triggered anymore.