Not really. Having heterogeneity among operating systems is better than pure homogeneity. Say, if everyone ran Linux, and some massive security flaw was discovered, we would all be screwed at the same time. However, if we ran different stuff, and some massive security hole was found for just one operating system, then only a small portion of the world is vulnerable at once. Besides, more operating systems can lead to more innovation, as long as there is good competition between them.
If the whole world focused and used just 1 OS for every system for a long enough time line, I think it would evolve fast enough to reach a point of perfection, where there are no security holes or flaws of any kind. I do believe that while programming has many ways of doing the same task, there is always an objectively best way to do it. Eventually the best way to do everything an OS needs to do would be found; it would be faster if there was only 1 OS to work with to reach that point.
where there are no security holes or flaws of any kind
this in itself is straight up impossible to know or prove. when can you say your program has no vulnerabilities? ever hear of zerodays? finding the best way to do everything in software will never be found or stay constant either.