Suppose that $M$ is a model of ZFC, $P\in M$ is a notion of forcing and $G$ is a $P$-generic filter over $M$.

It is a well-known theorem that if $M\subseteq N\subseteq M[G]$, and $N$ is a model of ZFC then $N=M[H]$ for some generic set $H$, and there is some $H'$ which is generic over $M[H]$ such that $M[G]=M[H][H']$.

But the proof I know uses Boolean valued models and is not particularly insightful about the following question:

Suppose that $M$ is a model of ZFC, $P\in M$ is a notion of forcing, and $\dot x$ is a $P$-name, such that if $G$ is a $P$-generic over $M$, and $x=\dot x^G$ then $G\notin M[x]$.

Can we give an explicit $Q\in M$ such that $x$ is $Q$-generic over $M$?

An additional question which is relevant to one particular case:

Suppose that $P$ is the Cohen forcing with $2^{<\omega}$. In such case every sub-forcing is isomorphic to $P$, what does that mean for us? Does it mean that the generic needs to be particularly chosen, or what?