Re: "originally" written by Sun?
'Switched' is a bit of a understatement of Sun's involvement.
Sun, along with AT&T themselves, Amdahl, ICL, SCO and several of the minor UNIX companies (and I think this included Dell), were involved in creating SVR4, which was, as you say, a merged UNIX. Eventually, these companies invested in an AT&T offshoot called UNIX System Laboritories (USL), which was given the UNIX ownership and copyrights. USL was bought (rescued?) by Novell, and the rest is quite well documented.
Of course, this single UNIX did not suit all, and IBM, DEC, HP and a number of others went on to set up the Open Software Foundation (OSF) to push their own Unified UNIX, just to poison the waterhole.
I was working for a part of AT&T up until late 1989, and I attended the SVR4 developer conference sometime that year. I also installed AT&T R&D Unix on Sun 3 kit, which was nominally titled SunOS 4.2, but was sitting on the early SVR4 codebase (this may have been just for R&D UNIX, though). AT&T used this version to emulate their large 5EE telephone exchanges during development, in what were called Execution Environments, replacing 3B20Ds and Amdahl mainframes.
SVR4 had a lot of code inherited from SVR3.2, SunOS, BSD and Xenix, and could be used like many of the source OS's by manipulating path and libpath to acquire their personalities, and included a lot of nifty technology including a unified software installer and an ABI that allowed software to be written for an architecture like Intel 386 or Sparc and run on any other variant of that platform, as long as it was running an SVR4 complaint OS.
As with all things, it would have been interesting to see where we would have been if OSF had not been set up, and SVR4 had become the single UNIX variant in the early '90s, for platforms including Intel (there were several i386 implementations of SVR4, including one from Sun themselves), especially if it were available at reasonable cost. I don't know how much it would have deflected the rise of Windows as a server platform, but it would have changed where we are now a lot IMHO.