I have two MBPs, an M1 Pro 16GB and an M1 Max 64GB. I run docker containers for data science-type academic research, and I definitely feel the memory limitation on the 16GB. The 16 is plenty usable for a lot of things, but I have to pay attention to RAM when using containers. I feel it a lot less on the 64GB, and I can multitask about as freely as I like without issue, even if I have a couple of multi-container docker compose projects open.
To the original question, I'd get the M2 Max 96GB between those two options. If you can configure more freely, I'd split the difference and get the M2 Max 30GPU 64GB. That's $600 less for eight fewer GPU cores and 32GB less ram. If you're not maxing GPU cores for something meaningful, that $200 may not be buying a lot, and I have yet to hit an issue of high memory pressure with 64GB that wasn't the result of a memory leak. I often deal with 10s or 100s of GB of data, and smaller stuff is fine in RAM, and I kick the bigger ones out to a database or other out-of-core option.