Without necessarily taking a position on the ethics, I would point to macOS and its derivatives as a clear example of this. Apple invested significant resources into a successor to System 7 called Copland, abandoning it in 1996. While the purchase of NeXT in 1997 hugely influenced the design of OS X, look at all of the free and open source projects that accelerated its development: Mach, Clang/LLVM (and GCC before it), KHTML, KJS, CUPS, much of the BSD and GNU userland, and the list goes on.
macOS, and by extension iOS, would not be where it is today without its open source core. Put a little spit and polish on it (no small thing, of course), add a kernel extension named Don't Steal Mac OS X.kext, and voila: new O/S.