You need to ask yourself what's the goal.
What monitor/TV do you have?
Do you want high refresh rates for competitive online games?
Or will you mainly play 1 player games, but want max settings at over 60fps @ 1440p/4K.
Some games favour ram bandwidth and low latency, and some games favour the 3D Vcache of the Ryzen CPU. The 9800X3D may be a very good gaming CPU, but it's not the best in all scenarios, especially against an overclocked 14th gen Intel CPU in some games and in most productivity tasks. Yet the price is about the same so people need to weigh up the pros and cons of each.
When I build PC's for mates to a specific budget, I ask them what they want from the PC and then I try and work out what the sweetspot is. I use Gamers Nexus, Framechasers and other techtubers for CPU and GPU benchmarks. You can use those reviews to work out the framerates of both which makes building a balanced system a bit easier. Something will always be a bottleneck and it can be a never ending cycle trying to eliminate any bottlenecks. But from experience, fast low latency ram is very beneficial and I always try and buy the fastest/lowest latency ram and best ram overclocking motherboard I can afford.
As long as you are equal or above the specs of the current generation of consoles, you wont have many issues playing any of the latest games at medium or higher settings as most games are simply ported to PC and are optimised for console specs, so anything above console specs and you will be golden. So a decent 8c/16t CPU, 32gb ram and a pretty powerful GPU with 16gb VRAM will serve you well for 1440p gaming for the foreseeable future. You may have to make compromises if you go lower, and if you go higher you may be able to play comfortably at 4k.
The choice you have regarding the 5900X and 5700X3D, I'd go for 5700X3D if it's gonna be used just for gaming. I built a PC for my nephew with a 3900X which is about 10-15% slower than a 5900X and he has no issues with any game. So either will be OK tbh, but I'd go for the 5700X3D out of the 2.
When I build myself a new a PC, I build it at the end of a platforms lifespan when the platform is maxed out and people have worked out what the best components are. Then I try and buy those components, then I tinker for some months to find the max OC, then dial things back knowing I have some oomph in the tank for later. Not everyone likes to tinker, so there will be other options for those people. But by buying at the end of the generation I usually get things much much cheaper when other people are upgrading to the new and bestest thing.
I have a 14900k, Apex Encore Z790 motherboard, 48gb M-Die DDR5 @ 8200m/t CL36, RTX 3090, everything apart from the 14900k was bought used, so the total outlay although a bit expensive was way under retail price, but was offset by selling old stuff. And even then, I got the 14900k for £380 brand new last year off eBay from a major retailer, so with most of the funds made up from selling older stuff it was not too bad. So the CPU is under warranty if there's any degradation issues later, since I turn off the boost stuff that pumps high voltages into 2 cores I don't think I'll have any issues tbh.
My PC happily handles 1440p gaming and has been awesome at pretty much max settings for a while now, apart from not being able to run full path tracing on Indiana Jones it will continue to chug along a few more years at relatively high gaming settings at 1440p. The GPU is a major bottleneck at higher resolutions, so I'll buy another GPU at a later date hopefully before the 3090 really starts to struggle.
The above is a 14900k with HT and e-cores turned off, so just using 8 P-core threads. It's running at 1080p, but it'll run at 1440p no problems.
My CPU should last for ages, well, until newer CPU instruction sets make it obsolete. The ram bandwidth and low latency will come into their own further down the line, from experience anyway. 32 threads is overkill for most applications, but I use my PC for other stuff so it comes in handy. I turn off the 16 e-cores when gaming and just use 8 p-cores, then when I encode/stream/video edit I turn everything on and it munches through whatever I throw at it.
Everyone has their own opinion regarding what the best is for their own use cases, I don't side with either AMD or Intel, I just want the best for me at a price I can afford that will hopefully last long enough to be cost effective over the long run. And buying high end previous gen has served me well.