My custom php file keeps 404’ing in WordPress when I call it. What am I missing?

You don’t need to submit the form to the PHP script – the script simply needs to be included or required by PHP – this makes the code within it available to your entire application.

As Tom pointed out in his comments, there are security risks to this approach – but it is also not required – most PHP applications includes hundreds or thousands of files on each page load – the trick here is not find the secure and performant way to include your code in the right part of the page load flow.

As you want to capture POSTED form data, you need to check the $_POST object for the data you have posted from your form, then validate it and run additional sanity checks – and then process it.