I think it is possible to construct a totally disconnected compact $K\subset \mathbb R^2$ such that $f:\overline{M}\to\mathbb R^2$ would send at least two points to the origin. I will make a certain assumption about a polygonal neighborhood around a polygonal path. I can try to fill this step in or find a reference for that step if you aren't convinced by it.

I will describe a procedure to construct a descending chain of compact sets $K_n$ whose intersection will be the required $K.$

Start with the square $[-1,1]\times [-1,1]$ and remove all points $(x,y)$ with $|y|<|x|.$ Call the result $K_0.$ Removing these points ensures that $\overline{M}$ will actually contain new points as limits of the sequence $(t,0)$ as $t\to 0^+$ or $t\to 0^-.$ Let $U_n$ be a sequence of open balls such that $(0,0)\not\in \overline{U_n},$ and such that $\{U_n\}$ generates the topology of $\mathbb R^2\setminus\{(0,0)\},$ and such that each ball in the sequence is repeated infinitely often. I want to ensure that:

- $U_n\not\subset K_n$
- $U_{n}\cap (\mathbb R^2\setminus K_n)$ is path-connected
- $\inf_{t>0}\{d_{\mathbb R^2\setminus K_n}((-t,0),(t,0))\}>1$ where $d_S$ is the path metric for a subset $S$ of the Euclidean plane
- $K_n$ is a filled polygon - a regular closed set whose boundary is a finite union of line segments

Suppose that $K_{n-1}$ has been constructed.
To ensure condition 1, if $U_n\subset K_{n-1},$ remove an open square contained in the interior of $U_n\cap K_{n-1}.$

To ensure condition 2, it suffices to remove a component at a time. So, given a set $K'$ satisfying conditions 3 and 4, we need to produce $K''\subset K'$ satisfying conditions 3 and 4 and such that $U_n\cap (\mathbb R^2\setminus K'')$ has fewer connected components than $U_n\cap (\mathbb R^2\setminus K').$

Pick a simple polygonal path $P$ of length $1000$ joining two connected components of $U_n\cap (\mathbb R^2\setminus K'),$ and lying in the interior of $U_n\cap K'$ except at the endpoints of $P,$ which each lie in the interior of an edge of $K.$
Because $P$ is so long, removing $P$ from $K'$ would not decrease the distances considered for property 3. But $P$ is a closed set so this would ruin property 4.
I want to say that for small enough $\epsilon>0,$ the set $$K'_\epsilon:=K'\setminus\{(x+a,y+b)\mid (x,y)\in P, |a|,|b|<\epsilon\}$$ satisfies condition 3. (With $K'_\epsilon$ instead of $K_n.$) The set $K'_\epsilon$ is a filled polygon whose vertices vary continuously in $\epsilon$ for small enough $\epsilon.$
The modifications occur at a bounded distance away from the origin, so the $\inf$ considered for property 3 won't care about the origin. It seems geometrically obvious to me that for small $\epsilon,$ a path of length less than 2 (say) with endpoints outside $K'$ cannot make use of the set removed in the definition of $K'_\epsilon.$ This is where I'm making an assumption. But given that assumption, we're done by setting $K''=K'_\epsilon.$

That completes the description of $K_n$ (apart from the assumption described above).

Any path in $M=\mathbb R^2\setminus K$ will lie in some finite stage $M=\mathbb R^2\setminus K_n,$ which shows that the points $\lim_{t\to 0^+}(t,0)$ and $\lim_{t\to 0^-}(t,0)$ in $\overline{M}$ lie at distance at least $1.$

$\mathbb R^2\setminus K$ is locally path connected and dense. The intersection $K=\bigcap K_n$ will be totally disconnected. Indeed any neighborhood of a point $k\in\mathbb R^2$ contains a loop winding around $k$ and lying in $\mathbb R^2\setminus K.$ The intersection of $K$ with the interior of this curve is clopen in $K,$ showing that $K$ has a base of clopen sets.