I'd just like to say that in my culture, cooking and eating people is not okay and I am going to assume, for the sake of discussion, that the same applies to the student and the person they were talking to.
What did the student really want to say?
I think it's very likely they wanted to ask if the other person had cooked for their family.
How would you explain this grievous error? Can you guess the student’s native language?
The student could be a native speaker of any highly inflected language that differentiates between the direct object (what you cook, what you give to someone) and indirect object (who you cook for, who you give it to) by using a different case, rather than by adding a preposition or changing the word order. For all I know, they could be Czech.
Uvařil jsi svou rodinu? Did you cook your family?
Uvařil jsi své rodině? Did you cook for your family?
The only difference in these two sentences is the case. English doesn't do this through inflection. You have to add the preposition "for". If you ignore this and translate these sentences word by word, you get "Did you cook your family?"
Have you encountered this issue in your language learning adventures?
Not this issue in particular but I made a hilarious, cooking-related mistake earlier this week when I was talking to my Italian language partner. We were talking about the different uses of the verb "cucire" (to sew, to stitch). My partner says: "So you've come to see the doctor because you have a deep cut on your hand. What happens next?" And I say: "Il dottore sta cucinando la mano." (The doctor is cooking the hand.)
We both burst into laughter.