The idealist and dreamer in me wants to agree. It'd be nice to not to have to change hardware unless you want more performance or features.
The realist in me understands that support doesn't come from nowhere. It needs time, effort, and funding. Since time is finite, more developer time put into supporting old things is also less time put into working on new things.
I think you are may be seriously underestimating how much time, effort, and costs support can be, and it's not down to just Microsoft, but also to all of the hardware and software developers even remotely involved. Stuff like drivers would be pretty important here, and does this even extend to applications too? if so, which ones, and why are some mandated and some not? Market share? And does this apply just to Windows 10, or all versions going forward? You're pitching a pretty broad request that has a lot of considerations.
Wanting to mandate support for something for around twenty years after it release is a tall ask in my mind. You might think this just keeps things as they are now, only with longer hardware usability, but want to know what may instead happen? Either most would-be hardware and software developers won't even get involved because they won't have the startup capital and insurance (so this benefits those already entrenched in the industry and hurts the chances of newcomers) or even if they have it, they'll deem it not worth it, so say goodbye to risk-taking and new ideas, and say hello to even more stagnation... and/or the costs of this may just drive hardware and software prices through the roof to compensate. Of course, just mandating Microsoft to support Windows 10 longer won't do this, but I'm applying your idea on a broader scale to the whole industry to show how massive of a drain it could be to mandate that level of support, and what could happen as a result.
When support for Windows 10 ends, it will have gotten around 10 years of support, and as others said (and while I'm not necessarily recommending this), using it after support ends doesn't automatically equal a non-functional PC and you can continue using it as it is. Linux also exists and tends to support older hardware. Hardware that isn't supported under Windows 11 will be nearly a decade old by that time though, and this is pretty tame compared to some past Windows version requirements.
There's another consideration I want to mention. You raise the point that some people can't afford PC upgrades. While that's unfortunate, I'm not sure how prolonging support for given Windows' versions solves this, because there's some things you may not be considering. For example, the current stuff that is very cheap, is usually cheap in part because it's more near its end of support life/usability. If everything had a mandated twenty year support life, then all this does is push that point back, and extend the middle range, so now you can expect stuff that is decade old to suddenly cost a lot more than it does now, despite its age and lack of performance, and you can expect stuff to not get cheap until it's even older. So those people who can't afford PCs are now going to be even further behind, on much older hardware, and thus worse off than they are now.
I guess what I'm saying is, sometimes complicated matters aren't easily solved, sometimes it's not as easy as "just do this", and sometimes good intentions don't result in the vision they are trying to achieve.