where should I invest my money: chip (Max M2 or Ultra M2), CPU cores (12 or 24),
The most usable fact here is that the single-core performance of all M2 versions is about the same. That means M2, M2 Pro, M2 Max, and M2 Ultra are actually all the same CPU speed...unless the application is strongly optimized to send parallel tasks to multiple cores. If it is, then now, the number of cores available can scale up the speed.
Photoshop is sort of, but not totally, able to take advantage of multiple cores. It is not always possible to do so in an app that edits a single image at a time, it is easy to run out of tasks to hand to other cores. Therefore, you might not see much difference between M2 Max and M2 Ultra in the Cpu department in Photoshop, even though the Ultra has double the CPU cores.
You will see more multi-core difference if you are batching in Lightroom or Camera Raw. Because those apps can frequently be used to edit or export many images at once. Each image's edits can be passed to a separate core. Applying the same edits to 100 images will take far less time in LR/CR than in Photoshop.
GPU cores (38, 60, or 76),
Again for Photoshop you might not see much difference between M2 Max or Ultra in the GPU department. Photoshop does use GPU acceleration, but again it doesn't have the opportunities to apply it as much as a video editor or 3D app can, those benefit very greatly from more GPU cores.
Photoshop loves memory, and your files seem large enough that 64GB can be justified. Relatively few benefit from 96GB, but with your file sizes, you might make one where 96GB would actually get used, so if you can afford it, it might not be a mistake.
The ArtisRight channel on YouTube performance tests many Macs for photography. The link below does directly to a Photoshop test on the Mac Studio M2 Max vs M2 Ultra, using a known, downloadable benchmark test suite. The difference between M2 Max and M2 Ultra is not significant on the small and medium tests, with the medium test being a 15.7GB file. Only with the large test does the M2 Ultra pull ahead significantly, but that is a 56GB test file, and the M2 Ultra had 64GB while the M2 Max had 32GB, so in this case it looks like it was not the GPU or GPU but the memory that made the difference, because a 64GB Mac can handle a 56GB file much better than a 32GB Mac, with much less VM swapping.
Hopefully all of this will help you figure out what you need to do.