In addition to the stuff I mentioned above, I deleted Xcode again, reinstalled MacOS, and then reinstalled Xcode 13.4.1 again, and that still didn't work.
Found the solution on the following website "Fuse Connection"
https://forums.fusetools.com/t/how-to-fix-xcode-when-installing-the-required-components-breaks/7914
Go to Finder
Aplications -> Xcode
Right Click Xcode
Show Package contents
Then go to /Contents/Resources/Packages/
Install MobileDevice.pkg ...
I tried Xcode again, but it still didn't work, so I installed all the 4 packages listed in the packages folder, tried Xcode again, and then it worked!
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: