@Engineer
The problem with this approach is that it assumes a debug build of code equates to the development push server and a release build equates to the production server, which is not the case.
Its actually not the build, as I said in my question that is important and dictates the push server, its the distribution signing that is.
You might have a debug build of code that you want to publish to TestFlight; or you might have a body of code that you first test running with Xcode,then without modifying it you want to build and publish to testflight/App Store; or you might want to create an archive, and then distribute that same archive to TestFlight or as a developer distribution .ipa, and so on.
Maybe I could look through the Firebase Crashlytics code, they detect when code is debuggable i.e. when the get-task-allow entitlement is set, I expect that would be useful and relevant to obtain in this case as that will vary with the distribution signing.