How to make a copy of Xcode.app which is installed from App Store?
It's possible that modifying Xcode in this way is triggering macOS's built-in security features.
However, there are two easy ways to make a copy of the original app.

Compress the Xcode.app into a zip file.

A copy of the original Xcode will be saved as part of your backup, which you are already maintaining for reasons that include restoring modified apps.