No. PHP isn’t aware of whether you’re running a webpack task or not, so it can’t toggle how to serve that file. In theory, you might be able to write your own code that would conditionally import files from different locations if some kind of header was present, but there’s nothing like that currently.
If I’m inlining files I treat them as code, not assets: They don’t go in the assets folder or run through the build process. IMO that’s the simplest solution to this problem.