How can I completely uninstall Xcode in macOS Mojave 10.14?
What finally solved the problem for me was to download and install the Command Line Tools as well as Xcode (in that order) from the Apple developer site.
After the next reboot, the Mac App Store recognised Xcode as not installed and all standard libraries and compilers were available again (which was not quite the case with Command Line Tools only).