In the sentence
What did she cook for you for dinner?
the use of the word "for" twice in close succession feels awkward, and so it gets avoided. It is commonly shortened to:
What did she cook you for dinner?
the same meaning could be expressed by:
What did she cook for your dinner?
Both avoid the repetition of "for".
In the sentence:
< What did she cook for you?
there is no repetition, and so there is no need to omit a word to avoid it. There is nothing wrong with the text "for you", but the expression "for you for dinner" is akward and thus is not commonly used, even thoguh it is grammatically valid. Also, this expression not only uses "for" twice in close proximity, but uses it in different semantic roles. The required mental shit is potentially confusing, another reason why this expression ios not commonly used.