I took a linguistics class a couple of years ago. The cognitive advantages are so extensive because according to a school of thought (Chomsky and Pinker) language itself is part of our human nature, it's innate, and is a product of biological evolution of our human brain. Knowing and switching between different languages on the fly requires a lot cognitive focus but if practiced enough, it becomes second nature, even better if languages were learned while still very young. I grew up speaking three languages (Mandarin, Portuguese, and English) and I do see the cognitive benefits when I'm programming daily in 2-4 different languages (Scala, JS, Python, PHP for instance). I don't confuse language features from one language with the other while I see co-workers mess up from time to time.