Your milages vary, but in my case:
* 2012 rMacBook Pro 15": a major GPU defect found just as the 1-yr manufacturer's warranty ran out. Had to pay $300+ for repair although it was clearly a manufacturer's fault. After a threat of class-action lawsuit -- there were similar class-action lawsuits in motion for older MacBooks models made in 2007, 2009, 201x as well -- Apple started a repair/recall program in 2014 and they refunded my repair cost.
* 2 x iBooks in my college days: none of them lasted longer than 1 year; all failed due to some hardware problems.
* iPhone 3GS: didn't know how laggy it was until I upgraded to the 4Gs. Oneplus 5T is my current phone, with Samsung Note 3 as backup -- which was used for 4 years.
* 1999 Dell Inspiron: in service for 6 years and still usable. dropped it several times on concrete floor. Virtually indestructible, but I wanted to get a new hardware (see my 2 x iBooks). Required no repair or replacement despite heavy use; in my Manhattan mini-storage now.
* 2008 Dell Inspiron: cost $350 (with some special offer from Discover Card) and used it until I got my 2012 rMacBook. Virtually indestructible; required no repair or replacement; still running and my backup laptop.
Based on my experience, Dell XPS 15" is going to be my next workhorse.
As far as smartphones are concerned, many years ago before his death, Steve Jobs claimed to have "cracked" the integrated TV business, but Apple decided not jump into it -- because their product lifespan is too long, especially compared to iPhone's 2-yr short lifespan. The iPhone's 2 year short lifespan in turn was in large part determined by 2 year contract subsidies in the US. Likewise, you see in Horace's second graph that the iPhone lifespan increased as US carriers phased out 2 year-contract subsidized model in favor of monthly payments with no subsidy. I'm very disinclined to believe that Apple's QC improved so much in the past 4 years that the iPhone's lifespan nearly tripled and, contrary to a few fanboi's anecdotal stories about Apple's stellar hardware QC, I'm willing to bet a few pennies that the overall lifespan trend holds the same for other phone manufacturers as well.
In short, I think it's mostly it's mobile carriers' subsidy (or lack thereof) that changed consumers' buying habit and iPhone lifespan, not Apple's super durable hardware or quality control.