This is never true in the circumstances you request.
The reason is that if $[\text{id}]_U$ is generated by $\kappa$ in this way, then indeed the whole embedding $j_U$ will be isomorphic to the induced ultrapower by the normal measure. If $j_U:V\to M$ is the ultrapower by $M$, then every element of $M$ has the form $j_U(h)([\text{id}]_U)$ for some function $g$, and by composing with your function $f$ we would get that every element of $M$ has the form $j_U(g)(\kappa)$. But this occurs only when $U$ is isomorphic to a normal measure on $\kappa$, the induced measure $X\in\mu\iff\kappa\in j_U(X)$.
But if $\kappa$ is measurable, then there are always measures on $\kappa$ that are not isomorphic to any normal measure. For example, a product of measures $\mu\times\mu$ is never isomorphic to a normal measure.
I conceive of all of this kind of reasoning as part of what I call seed theory. An elementary introduction to seed theory is available in my paper:
- Hamkins, Joel David, Canonical seeds and Prikry trees, J. Symb. Log. 62, No. 2, 373-396 (1997). ZBL0890.03024.