Starting with a UNIX foundation helped
I don't think it was just being a niche machine that helped Apple stay ahead - the well-tested UNIX heritage certainly was a plus. The changes added in El Capitan (OSX 10.11) should help keep them ahead. Now there are plenty of things that not even "root" can do without booting into a recovery session (similar to runlevel 1 on UNIX / Linux). As mentioned, though, there is still major work to be done.