After upgrading to Xcode 12.5 (upgraded from the App Store), some CLI tools like xcodebuild and codesign_allocate are failing immediately, saying:
Executable requires at least macOS 11.0, but is being run on macOS 10.16, and so is exiting.
Even though these are failing, xcode-select works, and the location is set - running xcode-select -p outputs /Applications/Xcode.app/Contents/Developer. Everything seems to be installed, which xcode-select --install indicates. I've tried installing the CLI from source, and putting the bin directory in PATH seems to work ok, but this doesn't include xcodebuild. However if I don't do manually install those cli tools, I still end up getting prompted to install the cli tools, and after they are "installed", I continue to get the prompt.
Everything within the Xcode IDE works fine, and I've tried reinstalling Xcode multiple times. I'm on the latest version of Big Sur (version 11.3), and this computer has never even had a version of macOS lower than that. Everything was working fine before this upgrade.