Operating systems include lots of libraries and drivers. Programmers write code that depends on OS-level functionality.
Before Unix every computer manufacturer had their own proprietary OS, specific to their hardware. While that did lead to some innovation and competition, it also made changing hardware platforms risky and expensive.
Rob Pike wrote about this 25 years ago:
Also, there are myriad reasons why big tech companies wouldn't unite to build anything, let alone something as complex as an OS.
Why? I use it for both and it is expressly excellent at them. With configuration and automation frameworks on top like NixOS or k8s, you can build just about anything.