For when [insert phrase]
5 cakes you can eat for when you're trying to gain weight.
Materials needed for when you build your time machine.
Recommended surrender terms for when our planet is invaded.
Word for when a writer uses alternative spelling.
Those sentences don't sound right, they get the meaning across but are awful! I can think of different ways of phrasing a sentence without using "for when". I view "for when" in the same way I view "ain't no", as in "ain't no world big enough for you". Sounds like a ugly verbal shorthand.
There are instances where using "for when" makes sense, as in:
What to signs to look for when getting pulled over.
But the former sentences don't fall into this category, at least to me. Can someone help me understand if this is a correct way of writing?
There is nothing wrong with the usage "for when", which is a short form of "for the time (in the future) when" but your 4 primary examples are all phrases, not sentences, which might be why they sound odd to you. They might be article headings or paragraph (section) headings, where this style is widely used, as in "5 tips for a healthy summer" "6 precautions for when it rains", etc. They can also be completed into acceptable sentences as in
SAVE THESE 5 cakes for when you're trying to gain weight.
WHAT ARE THE recommended surrender terms for when our planet is invaded?
Please note that in a sentence like "what are the signs to look for when (you are) getting pulled over", 'for' is part of the verb "look for" and is not being used together with 'when' in the form 'for when' as in your first 4 examples; it is an entirely different grammatical construction and conveys a very different meaning.
"For when" can be substituted by "if" or just "when." Using "for when" will only make you sound pompous.