Here is a simplecomparatively concrete counter-example, which uses a similar idea as in Andreas' answer.
Let $N$ be the structure consisting of the binary tree $2^{\lt\omega}$ together with its branches $2^\omega$, with the initial-segment relation and the same-level relation. Let $M$ be any countable elementary substructure of $N$. (One could replace $N$ with a saturated elementary extensionsextension, if this feature was really desired.) Let $M$ be any countable elementary substructure of $N$. LetConsider the function $f_a(x)=y$, if $y\lt a$ and $x$$y$ is on the same level as $x$. That is, we map the part of the tree at levels below $a$ to the path of nodes below $a$. This function is uniformly definable, and the domain consists of the finite sequences shorter than $a$. We may place the discrete topology on the points, although other topologies will also work here.
Now select any branch $d$ in $N$ but not in $M$, and consider $f_d$. This function picks out the nodes below $d$, and is therefore not definable in the substructure $M$, but it is definable in $N$ from $d$. Meanwhile, given any finitely many finite nodes, there is a branch $b$ in $M$ that agrees with $d$ that far, and so $f_d$ is approximated by $f_b$ on that finite set.