Define a few years...I have a Late 2013 27” iMac, 32GB, 3.5GHz i7, GTX 780M, 3TB Fusion. It scores 47,850 on Metal (RX560X comparable), 4487 SC, 15263 MC...and does everything I need it to do. If the Fusion bites the dust, I’ll open it up, upgrade the PCIe module to something larger, add a Samsung 860 EVO 2.5” SSD, clean it out, and redo the thermal paste on the CPU and GPU. While I cannot go higher on the CPU or the GPU, they are still competitive, albeit at the low end against a 2019 iMac. I have no problem with it running sustained at its Turbo Boost of 3.9GHz. So, going on 6 years and I have at least 4 more years of useful life out of it.
A core i9 2019 iMac should have a good 10 years of life in it. It’s not thermally throttled intentionally, it simply not allowed to run wild with whatever TDP it wants, given Intel’s complete disregard of TDP.
Not upgradeable? Adding up to a 128GB of DRAM, add a 2.5” SSD internally, upgrade the PCIe SSD (Apple part), who needs a CPU upgrade? Intel routinely only allow two generations per chipset and Comet Lake-S is already being rumored to be moving to a different LGA socket, so if you have the Core i9, you’re out of luck, but something less should be upgradeable to the i9-9900K. The Vega 48 is quite a potent GPU, even if the RX580X isn’t. An eGPU is a potent supplement to the internal GPU.
You will get about the same amount of life from a 2010-2012 Mac Pro as you will from the 2019 iMac. If your needs change drastically during that time, chances are you won’t be upgrading a PC either, but buying a new one, since DRAM, PCIe versions, LGA sockets are different and storage interconnects will have changed. You aren’t gaining that much building a PC, you just think you are.