Is there a single word for a mistaken intention due to a situation

Solution 1:

Cash in comes to my mind. I know it is mostly used in financial contexts, but it might work well in the situations you mention.

According to Oxford, to cash in means to take advantage or exploit a situation. (Check the list of synonyms.)

'To a certain extent, he's cashing in on the latest literary fad.'

Another definition found here reads: "To profit from; to use an opportunity to maximum advantage, especially financially."

Opportunism is also a good fit, as Gnawme suggests.