The Pixel 2 had a launch price of $649 vs the iPhoneX at $999, so ~35% more. That's not really a fair comparison, I imagine if you compare to a similarly priced android phone released at the same time, it'd be a closer result.
Where apple does do well is supporting devices for much longer with software and security updates. So running older android phones is prob not a good ideas from a security perspective.