And CP/M copied from DEC's operating systems, most especially RT/11.
I haven't examined the code myself, but the source code to the original PC-DOS is available and can be compared with CP/M. I've been told they were not copies.
Tim Paterson, of Seattle Computer Products and later Microsoft, gave a good talk at VCF West 2019 where he describes the history of 86-DOS (licensed to become PC-DOS and MS-DOS). There was an intention for significant API compatibility with CP/M, but no code was taken from CP/M.
I haven't examined the code myself, but the source code to the original PC-DOS is available and can be compared with CP/M. I've been told they were not copies.