These days they are built by teams, generally. Ironically, corporate security at Microsoft is such that many teams don't know what other teams working on similar or important processes are doing, while in Open Source, you have kernel developers working for Google, IBM, Red Hat and of course Linus Torvalds is paid by the Linux Foundation. GNU tools developers have a similar range of employers and they know what is going on in the kernel and vice versa. Linus Torvalds is an interesting character. He created Linux to do Unix programs affordably, which means mainly technical computing (if he ever stops doing Linux he shall probably have a cushy University post) and he uses Windows. Nevertheless there is one memorable email when he was discussing suspend routines in the developer's list where he asked "What makes you think that because Windows does it it is EVER a good idea?" The animousity and competition are all on Microsoft's side as far as he is concerned. He uses it, but there are things he just doesn't like about it.
You generally don't build OSes from scratch by the way, without tools such as cross compilers and maybe separate partitions. Gentoo Linux requires you to recompile everything to install it -- which means you have to have a host system and, unless you are using stage 3 tarbells to start, install it methodically. I'm in the final stages of trying to do a Linux from scratch installation that way -- using Gentoo Linux as the host system.
Operating system construction is a college course in many computer science classes and in fact there is an OS called Minix which is intended to teach Operating System Construction (which makes the infamous de Toqueville Institute report which claimed Linux was stolen from Minix nonsense -- while Andy Tannenbaum, the Minix guru was advising Torvalds at the start, as it finished he told him if he were getting graded on the kernel his grade would be very low. Those operating systems tend to be much simpler than the operating systems we use, and the Linux kernel has been revised many times, as well as being ported to on many many other machines and platforms.
Mac OS X is a development of an earlier Jobs system called the NeXTStep developed during his exile at NeXT computers and derived from BSD Unix (which itself was written as a grad school project by Bill Joy, mainly, who went on to co-found Sun Microsystems). Ironically, Mac OS X uses the Mach kernel written by a man who is now a senior vp at Microsoft back in the eighties when he taught at Carnegie-Mellon University.
But generally you start with a host system and develop a toolchain on it, then slowly you fork your system away from the host OS as you build whatever it is you are looking for and find it works or doesn't. It's a gradual process which is well documented in the Unix world.