I managed to solve this myself after a while. Hidden deep within the parallel computing toolbox folder in the Matlab root there is a file called “ptxExpr.p” that I needed to add when running the application compiler. And after that the error message will change to a different file – and another – and another, and so on, but if you keep searching for .p files and adding them it eventually worked.
But it’s a bit absurd to have to do this manually when using the application compiler. Please fix this in a future release Mathworks…