More like excellent industrial design, good chip design and good software support*. The hardware itself is nothing special; having a badly engineered aspect has been the "standard feature" for many Apple devices (butterfly keyboard, soldered SSD-s, phone chassis prone to bending are some examples that come to mind).
For comparison, I had a Huawei P7 phone (back when Huawei was still in good graces everywhere) that was thinner, and had better screen than the contemporary iPhone while also having a strong, beautifully machined aluminium chassis. It proved a very durable and dependable tool, and cost ⅓ of the price of an iPhone. The weak point was update support—it was shipped with Android 4.4.2, updated to 4.4.4, and that was that. Android 5 was supposedly released, but never arrived via OTA and when I updated manually after spending some time searching for the new firmware, it proved to be buggy and half-baked.
*Caveat: when I tried to download KDE Connect for an older iPhone, I couldn't because the OS is no longer supported and Apple store doesn't offer older versions of the apps. On Android I can still dig up an old version from Github or some other source and install what I need—I was still able to install Kodi on my old 4.4.4 phone to use as a DLNA music streamer. On an old Apple device, you're shit outta luck.