I don't see how that could possibly be true objectively, it's my impression that neither platform has any intrinsic hardware qualities that allow it to last longer, but with a Pixel I do have more control over how long I can keep it running if it doesn't succumb to irreparable physical damage.
Anecdotally, it's also my subtle impression that iPhone users are more inclined to update frequently regardless of how much longevity they could get out of it. I just buy my phone and keep it operational for as long as possible, only buying another if my current one is physically inoperable, and I feel like I'd get to that point more quickly with an iPhone, since parts are more expensive and not as readily available.
Main thing is iPhones get security updates for about 8 years. My iPhone 6S is still fine. Pixel in particular will now get 7 years, but this wasn't the case in the past. Random other Android phones don't have good support, and even third-party repairs might be harder.
That's a fair point, and the 6s is a great piece of hardware imo. I just find it frustrating that after security updates stop for my mac, I can definitely keep using software that's always worked on it, supposing I have the executable and any third-party backend services are still running. On my old iPad 3, since the App Store is the central software distributor, more and more apps have been pulled off of it at the discretion of the publisher. It was never really that useful of a device to begin with, but to use the same software, I'd need to buy a new piece of hardware, despite new iPads offering practically nothing substantial in terms of added value (for me) since mine came out. They're nice I guess, but not hundreds or thousands of dollars nice when I likely wouldn't use them for anything different.