If a “cooking show” is grammatical, why not a “cooking book”?
Solution 1:
To cook as a transitive verb has the following meaning among many others:
To alter or falsify.
As a slang, it also means to happen as in "What's cooking?" which means "What's happening?"
To cook has some negative connotations especially when it comes to the financial sector or narcotics business.
To cook the books means
to keep false financial records for an organization
I suspect the reason why "cooking book" or "cook book" is not as popular as "cookbook" is the negative connotation of the verb to cook when it is placed before the noun book with a space. I don't think it is a grammatical issue. People have chosen to use "cookbook" as it sounds better.
As for "cooking show", as @Jacinto commented, I don't think it matters that much because the show is about cooking (action) or how to cook food.