Headers sent by PHP only matter really to the browser in this case. Apache isn't going to make its own page because you are already processing the page, and if you sent something, the two would conflict.
Yes, the .htaccess
file is going to stop Apache from showing an error page because your rules makes Apache think it no longer has a 4040
error, because it has found a page to show.
Sending a header is really only a 'status message', and doesn't make the browser or server show a particular page. (Although most browsers will).
As Dav pointed out in the comments, you will want to send 404 errors to their own custom error page.