I was having an identical issue on one of my sites and found this question here, after roughly 10 hours debugging it turns out to be a combination of .htaccess and a PHP routing script. There are no static .html pages on my site, everything is built on demand and normally works ok but one directory was behaving strangely with 'Chrome Lighthouse' scores, turns out everything was being served with a 404 from that directory although pages looked and functioned as expected.
The reason being my .htaccess was misconfigued and not routing that directory directly to the PHP script, there was however an 'ErrorDocument 404' setup which inadvertently was stepping in. As that document name DID hit the pattern for the PHP routing script the page was then built successfully yet the 404 remained. As with most config issues a one char fix was needed, in my case adding a '-' to the RewriteRule regex pattern. No more 404 and Lighthouse all green.