Run `xcode-select —-install` on your terminal. It’ll install the Xcode command line tools only, no apple account required. I’ve used multiple macs at work and never sign in with an Apple ID on them.
That sounds unpleasant. Hasn't been a problem for me, however, my work laptop is managed 100% through our corporate IT folks, including the Apple OS updates and packages. I've never needed a personal Apple ID to get Xcode.