I'm still using Windows 7 too even past its lifetime support but I will be upgrading to Windows 10 soon.
I'd say Windows 7 is in every way, pretty much compatible with whatever programs that all older previous Windows can run it, even better than Windows XP.
If you still would like to run Windows XP, I'd put it on a virtual machine instead.
But generally its sort of a bad idea to keep running Windows 7, because if you're gonna buy a modern machine and it most likely does not support Windows 7 natively, you will run into hardware issues - particularly with missing drivers for Windows 7. Sure you can install Windows 7 on Windows 10 modern motherboards, but you may not have drivers for it such as sound or graphics.
There's an exception to that though, by buying an older (particular) motherboard
with the Z390 chipset - that is if you want to dual boot both Windows 7 and Windows 10 and then trying to get all of the hardware parts that are compatible for it -if you can find them in stock. Double check though that the particular motherboard model does support Windows 7 and 10 before buying it.
However if you're planning to play retro games (especially older ones around 1990s), the virtual machine route may or may not be a good compromise as you might experience issues with sound or frame stuttering. For that retro gamers either still build and maintain a retro pc build or use a dedicated retro emulator to play MS DOS games, designed to play them correctly.
I love Windows 7 more than Windows 10. I just wish that Windows 10 wasn't that too intrusive. Its UI to me looks more like that of a mobile phone that keeps updating itself rather than a real computer...
You can also go the dual boot route, installing both Windows and Linux like me. You'd have to read up though on BIOS, UEFI booting mode, GPT and MBR, bootloaders (love GRUB) and most importantly - disable Windows automatic updates because that will screw up your dual boot and render it possibly unbootable.
However, you can also just install Linux on a virtual machine to avoid all of that, and would be my suggestion if you're a beginner - as it will allow you to mess up your Linux install and revert back to original state if ever you make mistakes in Linux (Linux can also get broken, mostly due to user errors made). Dual booting on the other hand allows you to harness the full power of your hardware.