A couple of things: there are robust CDN plugins that you should use instead of trying to do this manually. That’ll handle performance if that’s the motivation for separating php from other files.
If your concern is just that you like to separate them in your source because of personal aesthetic code organization reasons, you should try this only in your own code (private plugin or theme) to reduce the surface area of the problem.
Certainly don’t try to move the WP Core files (CDN plugins copy to CDN, rather than move). And ‘simply setting “siteurl” and “home” to the url of the fileserver’ is also certainly the wrong move, as you know, lol. WordPress is fundamentally built on the assumption that the files exist together: Think about image editing features in WP; the file needs to be in the same place for the php to manipulate it.
If you are dealing with just your own code organization, then you can avoid issues like
file_exists() coming up false (and
require causing fatals) because it’s on the wrong server. From there, you can write wrapper functions around WP apis to handle the new URLs, or perhaps use some rewrites on requests to certain file types within just your own folder.
There is a WP rewrite API for that, but the knowledge is mostly in knowing Apache’s rewriting.
TLDR: I think you either use a CDN Plugin, or the WP Rewrite API is what you need.