Let's begin by correcting, as Victoria does, your definition of what it means for $G\subset\mathbb{P}$ to be $M$-generic, in the case where $M\prec H_\theta$ is a possibly non-transitive elementary submodel of some $H_\theta$. You said to be generic means to meet every dense subset $D\subset \mathbb{P}$ with $D\in M$, but this is not the right definition. You want to say instead that $G$ meets every such dense set $D$ inside $M$. The pointThat is that it could be, that $G\cap D\cap M\neq\emptyset$. If we only have $G\cap D\neq\emptyset$, yet because it isn't transitive, then $M$ can't seewill not have access to the conditions $p\in G\cap D$ that are useful when a filter meets a dense set. So it is the corrected definition that treats $\langle M,{\in^M}\rangle$ as a model of set theory in its own right, insisting that for every dense set in this structure, the filter meets it.