This doesn't really change anything. Low/no mountain terrace-farms are still going to be weak while 4/5 mountain terrace-farms are going to be super-strong.Instead of boosting the food the terrace farm generates, why add an additional yield, like 1 tourism or 1 science per farm.
If that's not enough of a boost, you could add to the +1 food / adjacent mountain +1 other yield per adjacent mountain, be it science, culture, tourism, gold, or whatever. This would further boost each individual super tile, but presumably be rare enough to not be over powered. How often, for instance, do we see a readily workable, in range hill surrounded by 4/5 mountains?
Big clumps of hills are pretty rare but do exist, so this is going to be a nightmare to balance.Again, instead of adjacent mountain tiles causing this stacking buff, you could go with adjacent terrace farms causing this buff. I'm guess both of these options would be straightforward enough to code?