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.