CP/M -- "Control Program / Monitor" -- was a very simple piece of code that was easy to reverse engineer. Its essentially no different from the monitor you'd use to set up and run programs on your PDP minicomputer. Since everything has a common root its not surprising that it gets copied; I'm pretty sure that if QDOS wasn't available to Microsoft they'd have written their own.
As it happens the CP/M knockoff only lasted for MS-DOS 1.4. The CP/M system calls were rapidly replaced by those knocked off from UNIX for MS-DOS 2.0 and up although Microsoft kept the call mechanism (software interrupt and that A20 wraparound) for years afterwards.
Knocking off code was commonplace at that time. The early IBM-PC clone makers were helped in their efforts by IBM supplying a manual with their PC that included the source code of their BIOS. This code turned up in every clone until IBM noticed and their lawyers put a stop to it (in a rather gentlemanly way by modern standards -- they gave these companies a several month deadline to develop their own BIOS).