I've historically taken the stance that I should put money into the parts of the computer that can't be upgraded later, since those will be fixed for the life of the machine. So I'd invest a bit more in CPU and less in things like HDD and RAM. And this worked ok, but what I found is that occasionally there would be a change in something fundamental that makes your computer become obsolete more quickly, like the introduction of USB ports, SATA, Power PC processor -> Intel, bluetooth, etc. So it's hard to know when something like that will come up and disrupt your personal seven year computer use roadmap.
That being said, a few years ago I replaced the mechanical hard drive in my 2011 iMac with an SSD + HDD home-made fusion drive, and it went from borderline unusable to blowing my mind every time I booted it up (like from ~50+ seconds to ~15 seconds). I also ran VMWare Fusion frequently, and that old computer handled it pretty well, I suspect from the i7 processor. In 2016 the video card broke and I replaced the computer with a Core i5 iMac (also with a fusion drive), and I have to say that the perceived speed/performance gains were not that great. The only thing I can conclude is that the newer i5 was not as capable as the older i7; it certainly has fewer cores to play with. It is fine for web browsing and typical home use, but VMWare guests run pretty slowly -- faster than the old iMac, but not as fast as I'd have expected.
I think you need to determine what you'll be using it for, and then see if the i5's 6 cores seem like enough versus the i9's 8 cores + hyperthreading. $400 is a lot of money, though. I kind of think that most people will be fine with the i5.