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.