This is only a partial answer concerning pepper, but it is known that coffee plants grown in higher altitudes have lower caffeine content [1]. This is due to the lower abundance of insects, against which the coffee plants protects itself with caffeine (which is an insecticide).
It seems there are studies on the effect of piperine (the active ingredient in black pepper, piper nigrum) as insecticide as well [2]. Also, there is the well known effect of capsaicin in capsicum plants (chilis) that also serve as a deterrent against mammal consumption (but not against birds, which is the evolutionary intent, so to speak, as to spread the seeds further).
Together, I think it might be possible to conclude that pepper grown in higher altitudes/harsher climates might be milder actually, due to lower pressure on the plant to protect itself against consumption. If the flavour profile overall, on the other hand, is more potent or developed, is probably a subjective taste.
Also, consider the sought-after Kampot pepper is grown in an area very close to the sea in a humid climate, pretty much the opposite of an arid mountain climate.
[1]: https://www.sciencedirect.com/science/article/abs/pii/S0963996917307858#:~:text=Caffeine%20and%20CGA%20contents%20decreased,1%20100%20m%E2%88%92%201).
[2]: https://academic.oup.com/jee/article-abstract/70/1/18/2212311