You get ideas from daydreaming. You get ideas from being bored. You get ideas all the time. The only difference between writers and other people is we notice when we're doing it.
I have nothing against younger women and older men on screen. What is sad is that so many women over 40 who have so much to give aren't being considered to play opposite men their own age or younger.