I encountered a similar issue with Xcode 15 Beta and discovered a workaround that could be helpful. I noticed that the builds failed specifically for schemes with longer names and those located in longer file paths.
By relocating my entire project to a shorter path, thereby reducing the absolute file path length, I was able to successfully build the project that was consistently failing before.
I suspect there may be a correlation between the build failures and the length of scheme names and/or absolute file paths. If you're grappling with the same issue, giving these steps a shot might alleviate the problem. However, this could be a bug that Apple needs to address.
Hope this helps!