That study came to the conclusion that spices:
a) make food taste good
b) are good antibacterial agents to keep microbe counts down.
They discount the sweating theory, rightfully so (much easier to just sit in the shade to cool down), but also think the “cover up the taste of off-food” theory goes nowhere… they may be missing the link between this and the antibacterial idea.
How recently was it that people discovered what bacteria and microscopic things were, and what they did to us? And how long did it take for that knowledge to trickle down to the third-world peasants who came up with all these spicey dishes? - lots of people still don’t know the difference between a fungus and a bacteria, or care!
These recipes for “spicieness” were in use long before some guy in a lab coat looked up from his microscope and agar plates and said “I’ve found that cumin eliminates 80% of all bacteria - try putting it in your food”. Most likely people used spices as a means of keeping their meat (or whatever) edible and themselves healthy for a few more days than they could with none, without having any idea why or exactly how the spices helped… it just worked.
The spices probably kept relatively fresh food safer to eat, and the not-so fresh stuff that’s questionable still edible from both an antibacterial and taste/smell standpoint (so a bit of both theories). I still look and smell food that’s not-so-fresh to see if it’s still ok to eat, and do it sometimes, even with my microbial knowledge, refigeration, and resources to just get new food instead (and so do YOU :D)… so a dirt-poor villager sitting in a grass hut in the tropical heat 300 years ago would certainly eat questionable food to survive, and the spices helped them get and keep the food down and kept them parasite-free more often than not.
The linked study says that covering up rotten food smell/taste ignores that health risks of eating it; well yeah - but people don’t eat rotten food because they want the smell of curry wafting through the house tonight, they do it because there’s nothing else to eat! As I stated, people do eat questionable food all the time for many reasons (one of which is avoiding starving to death), and spices aid them in doing so, not drive them to do it.
And yes, spices did use to be some of the most expensive commodities in the world… I beleive for preciely those reasons - keeping food safe before refrigeration and all our fancey knowledge of today. It’s a lot more plausible to me that spices were in demand to keep people from getting sick and dying from food poisining than to make the kitchen smell nice or add a little variety to the menu of some scottish sheep farmer.
(But of course there were most likely a few rich royal-types who probably did pay that much just for something new)