Am thinking the hidden science underlying this kernel of folk wisdom might be because of the walnuts and not the cheese.
I can’t think of any reason cheese would impact intelligence. Nutritionally, it seems more associated with macronutrients like calories, calcium and protein. It has saturated fat, but more recent research is pointing to dairy fat from cheese, milk and yogurt as not being associated with cardiovascular disease.
But walnuts are a good source of Omega 3 fatty acid, which is associated with preventing age-related cognitive decline according to Oregon State University’s Center for Micronutrient Research.