An important thing to understand is that at the time 16-bit 8086 machines was just coming out to replace the current 8-bit machines, where the CP/M operating system was the Windows of the day. Everything with a disk drive intended for work ran CP/M. That version was later called CP/M-80 to differentiate it from CP/M-86 for the 8086 processor.
Unfortunately that took so long to get to marked that QDOS was written to have SOMETHING to run programs on, and that was essentially a quick reimplementation of the CP/M functions (but with a different syntax). QDOS was later bought by Microsoft and made into MS-DOS. Hence MS-DOS actually has a CP/M core deep deep inside, and therefore the amount of work needed to get a CP/M-86 program to run under MS-DOS was limited (not to a single byte, but manageable).
I had the pleasure to work a few years with CCP/M-86 which allowed multitasking very similar to what Linux in text mode (with virtual consoles) allow today. Unfortunately it never caught on. Oh, well, we have Linux :)