Now, I would like to know whether the following sentence with the topicalized NP in its original place is ungrammatical 2) You must cook this kind of food before you eat -----
That's complicated!
No, it isn't an example of gapping, so it's "ungrammatical" in the sense of your question.
But it is grammatical and acceptable when "eat" is used intrasitively and understood to refer to a meal (assumed to be made of the thing you cooked). The same usage works with simple coordination (where the Coordinate Structure Constraint would be violated by unbalanced extraction:
"Let's cook this food and eat!"
If we use a less flexible verb, you can more clearly show the ungrammaticality under the intended reading:
Grammatical:
This is the kind of information you must write ___ down before you share ___ with anyone.
Ungrammatical:
*You must write down this information before you share ___ with anyone.
*Let's write down the information and share ____.
(Note: it is
very difficult to come up with precise examples like this because English verbs are often flexible. Adding additional argument structure around the verb phrases helps, as above. In fact, looking at these sentences too long makes me a bit confused about my intuitions, and it seems that they do indeed sound better in general with a more flexible verb like "eat" anyway, almost like the grammaticality/acceptability is in part an illusion, although the middle gap is clearly a real gap.)