Windows PCs have substantially greater longevity. A Windows PC made in 2013 can still run a supported version of Windows today (and will still be able to until 2025). A Mac made in 2013 cannot still run a supported version of macOS (though, it can still run that same version of Windows until 2025).So what you're saying is : I shouldn't go with apple as there are better alternatives ? For the record, I do have Samsung S21 fe and Poco X3 pro with a gaming PC , but honestly the only thing that appeals to me from apple is their longevity, I don't always have money to purchase latest tech and I'm still a college student so that's why I wanted to invest in an entire apple ecosystem to save me the hustle of purchasing new tech every 2 years lol
iPhones tend to have longer periods of OS support, but both iPhone and Android have similar security update support durations. Your mileage obviously varies on the Android front. However, in both cases, your phone will generally develop issues prompting you to want to replace it well before it can't run the latest OS anyway. Battery performance over two years of ownership will degrade noticeably and then ever more so over the next three years thereafter. And if you live in a country where there is no Apple presence, good luck changing that battery. So, yeah, you don't really get much extra (if any) longevity when it comes to switching from Samsung to Apple for phones.
If you are having to replace your gaming PC every two years, you either didn't shop for it correctly the first time or your needs are seriously high end (way more so 256GB of SSD and 8GB of RAM).
On the tablet side of things, Samsung tablets generally run okay for the first year (still nowhere near as well as an iPad will) and there isn't really any other strong competition out there (and virtually none at all on the iPad mini side of things). But they're generally not using as fast of computing guts as their phones use and the experience will degrade faster. iPads really are king. Also, if longevity really is your top concern, consider the following:
iOS 16 - Only supports iPhones introduced in Fall 2017 or newer
macOS Ventura - Only supports Macs introduced in 2017 or newer
iPadOS 16 - Supports iPad Pros from 2015 and all other iPads introduced in 2016 or newer
That likely will even out, but right now, of the three, iPadOS is winning the oldest supported device award.