OP for your stated uses, you'll probably notice towards NO differences in performance between M1 and M2.
However, M1 is already a few years old now. So another consideration is how long until it shows that mysterious "long in tooth" effect spurring M1 owners to "upgrade." We all know it is coming... it is basically based upon an iPhone core, which works exactly that way.
If we assume the typical 7-year-use window before Apple drops support (plus about 2 for security updates only), M1 is already more than halfway to that 7 year mark. M1 launched in 2020, making 2027- just 3 years from now- year #7 for that platform.
So if I'm indifferent about M1 vs. M2, I pay what is probably a relatively small amount of extra money for the M2 version.
M2 launched in 2022, so it probably has active updates until 2029 or so, or about 2+ additional years.
Since OP is still clinging to a 2014 Mac, they are likely seeking another long-term Mac. M1 is probably going to disappoint them after only 3-4 years. M2 has a better chance of getting them towards 5-7 years before facing another replacement purchase.
Thus, IMO: M2 wins this contest for OP... unless OP wants to replace this next purchase much sooner than the decade since the last purchase.
And I suggest perhaps hopping in the Education store to get at least 16GB and at least 1TB SSD for a little more than $1K... and/or try to catch this same config (or better) in the refurb store. Why? Because again, OP seems to hang on for up to a decade... and I'm confident that 8GB RAM is not a decade long "good enough" option. I'd even argue 8GB is not enough for 2024 uses like some that OP shares... though the "trick" of handling overage demands by using SWAP can get people by when they actually need more RAM than what they actually have.
One more suggestion for OP: if you can hold out for an M3 Mac Mini launch (conceptually this year), the M2 option will likely drop in price comparable to M1 options, so then you could consider the full 7 + 2 years with an M3 Mini vs. what should be added cost savings with M2 Mini now one formal generation behind in the Mac Mini model. That could feed your cost-saving goal of having your cake and eating it too.