How long a prebuilt PC lasts depends on several factors – not least of which is who built it, and why. You’re probably going to pay more for prebuilds that are as future-proof as self-builds, because high-quality long-life components will naturally be more expensive than lower-quality, shorter-life components.
There is also the question of what you use your prebuild for. Keep running high-res graphics and hardcore RAM-draining games, and you’ll probably notice your machine running slower, giving you less when you play, after anything as little as 2 years, 3 at the most. If your gaming is less demanding, it’s harder to see the drop-off in performance, so you might get away with 5 years.
There is only so much future-proofing manufacturers can do to the components they put into prebuilds because a) the industry moves forward fast, b) their main interest is in remaining profitable, and c) gaming demands new capabilities faster than they can often adjust production lines.