I feel like someone pitched Mike Judge an analogy comparing penis manipulation to computer processing, and Judge liked it so much he built his season finale around it. That penultimate segment in “Optimal Tip-to-Tip Efficiency” just seemed too perfect, too sublime to have come about from a brainstorming session in the writer’s room. “OK, here’s our protagonists’ problem. How do they solve it? Preferably in a way that involves jack-off jokes.” In this case it seems that the brilliant solution came first and the writers plotted a series of problems to set it up.
That happens to me occasionally (not as often as I’d like). I’ll come up with a cool idea or twist or scene, and then I imagine a whole book or short story crafted around it. For instance I wrote this short story (Under another name. Oooh mysterious!) based on a sudden idea: “Instead of a voodoo doll, what if someone created a voodoo globe?” After several rounds of revisions, the voodoo globe idea started to seem ridiculous (it seemed so awesome in the shower!), and the idea didn’t survive the story that it had helped to spark.