I have faced the same issue since the macOS 15 upgrade. The best workaround that at least lets me achieve consistent builds is as follows:
Note: in case the build system is blocked, kill the CoreDeviceService process and try again.