It is irrelevant whether the cooking is in the recent or distant past.
"What did you cook?" is past tense. "What have you cooked?" is a present tense verb referring to a past event - which is why the tense is called "present perfect".
The commonest use of the present perfect "What have you cooked" is as a synonym of a present tense question such as "WHAT IS THIS that you have cooked?" or "WHAT EXPERIENCE DO YOU HAVE of cooking?". Notice that both of these present tense synonyms refer to a present consequence of the past cooking: in the first case a cooked item that exists in the present time, in the second case a particular way of thinking that exists in the present time in a human mind.
If you ask a question without context, you get a general, technical, and usually incomprehensible answer!