Personal thoughts:
1. Gaming. Performance is mostly based on your GPU. However, having used an RX580 8GB on an i7 4930K and then moving to a 7950X and getting much more out of the RX580 (in Baldur's Gate 3), as well as an RTX 3060 12GB running at less than 30fps on 4K (native and with dlss) on an i5 3570 to a 9800x3D (and going all the way to around 45FPS in 4K with everything on native and with 60+FPS using ultimate dlss 4K - all in Act 3 of BG3 so you know it's potentially lag city), I would say there's some impact from CPU performance of your GPU for gaming. I wouldn't go less than either the single 7800x3D or 9800x3D if gaming is most important. In a pinch, depending on other factors, I would consider also the 7950X, 9950X and 9950x3D (not out yet). 7950X as that's a proven brute force CPU (especially for productivity and if you clock it well, it can really go far even for gaming), the 9950X as that is the current gen version of the previous chip, and the 9950x3D as that's the supposed upgrade "middleground" between gaming and productivity in this current gen. The 7950x3D is not suggested because the 7000 series of CPU's are 100% silicon lottery based on getting any large amounts of memory going at any decent speed. Whilst the 9000 series at least with a decent board has a better chance of doing so by limited accounts.
2. Development. Unsure on how multi-threaded they are these days, but I'm assuming mostly still remains single threaded during compile and stuff or at best mildly multi-threaded. So you're looking at a fast clocker or something that just pumps out performance. You probably don't need the heavy multi-core chips like the 7950X, 7950x3D or their current gen variants. The 7800x3D and 9800x3D will likely serve you best in this regard.
3. Photo Editing. Haven't used any current modern version of stuff so can't really say much on that front. But I've never really seen anything really be heavily multi-threaded when editing unless if it's a batch run. So in most likelihood, you're again after a fast CPU and not necessarily a high multi-core one. So I would suggest of the AMD line to once again go with the 7800x3D or 9800x3D given your gaming considerations thus far also.
4. Video Editing. From my limited experience, I would say if you have memory for it already, you're looking at more the cores available on the CPU than just the speed. Although it does vary a lot also with codecs, engines, apps used, etc. But if I were to pick any CPU for this work load, it would be the 7950X, 9950X, or 9950x3D (not released yet). 7950X and 9950X only because if you can clock them higher, the performance difference shouldn't be that far off and it can brute force when your case is limited by cores, so the 7800x3D and 9800x3D will not be able to keep up when it does count (which Video content creation can do, but is limited by what is used). The 9950x3D because of the middleground again.
5. Machine Learning. It's mostly limited by your GPU, however, there are some factors that can impact on the speed of the models also; your CPU definitely has a say, depending on model being used, you may require frequent swaps from your memory or storage to the VRAM in the GPU to keep it fed; failure to do so basically causes to slow to a crawl (slowest component in chain). The RTX 3060 12GB I am using was previously testing Machine Learning / AI stuff on an i5 3570, and when loaded into the VRAM (and can all fit in there) it was OK, not great, but OK. But it will cause the CPU to go full tilt. Swapping it to the 9800x3D now, and it still fills the VRAM but when swapping the data through to it, the 9800x3D still ends up at least 50% all core use. So I would imagine that with a 5090, if you're not at least using a 9800x3D or 7950X/9950X or 9950x3D, it'll sit there waiting on your CPU a bit too much (which can be a problem if it needs to pull from long term storage like SSDs as well as the CPU is loaded). This can be especially vexing if it's your main rig as well; I do mine on the secondary rig so it can run on its own and not impact on me gaming or doing anything else on my main rig.
So given that, my (limited experience) recommendations would be:
1. 9950x3D (when released and you want middle ground and hope no core stuff handling issues like on 7950x3D)
2. 9800x3D (as most uses cases aren't multi-threaded enough to push it beyond this and especially so if you know your uses cases aren't multi-threaded enough to take advantage of more cores)
3. 9950X (If you want to clock the chip higher and also know that the stuff you do is guaranteed to use more cores over just speed)
4. 7950X (If you need an alternative to the 9950X that's cheaper and more likely available)