I don't want to get too philosophical here (like did God create God?), but how did Apple create Xcode? Would it have been possible for them to use Xcode to create Xcode? Or would they have to use another code program (and what might that be?). In general, how does that work with code editors?
Xcode now is probably made with Xcode. If you're wondering how that's bootstrapped, at some point in the past a version of (not even Xcode or Project Builder, but Interface Builder which in the early days of NeXT was the whole of the IDE) would've been built just using Objective-C source files, edited in whatever text editor, and Make/gcc.
No, they would not be able to launch Xcode to use it before they created it.
They had to use another editor like (say) vim which already existed. The original editors were presumably written straight to disk in machine code or something but now that we have editors we don't need to worry about that anymore.