This example is built around a standard example of a function for which both partials exist at a point, yet the function behaves badly near the point. That will be called $q(x,y),$ and is $(xy)/(x^2+y^2)$ except at the origin where it is defined as $0.$ One can then show both partials of $q$ are $0$ at the origin.
For ease of discussion we redefine the domain to be $[-1,1] \times [0,1]$ and will take $t_0=0$ noting that this is in the open interval $(-1,1).$
Now define $f(x,y)=q(x,y)-x-y^2.$ We have $D_1(0,0)=-1<0$ as required. Also $g(t)=f(0,t)=-t^2$ which has its maximum at $0 \in (-1,1)$ where it is $0.$
Now $f$ fails to have a local maximum at the origin, since (for $t \neq 0$) $f(t,t)=1/2-t-t^2,$ which tends to $+1/2$ as $t \to 0.$
Edit: This example is not differentiable at the origin (the interior point of the left side of the altered domain).