This question is a follow-up to this one. I tried to check whether the same statement as discussed for rings there is true for monoids too, but without success.
Let $M$ be a monoid and $u\in M$. Suppose there exists a unique $z\in M$ such that $uzu=u$. Does it imply that $u$ is an invertible element of $M$, with $u^{-1}=z?$
The only thing I see is that it implies that $z=zuz,$ since $$u(zuz)u=(uzu)zu=uzu=u.$$
So $z$ must be a (unique) von Neumann generalized inverse of $u$. But this is far from enough...
EDIT: this has been reworked multiple times due to discussion below. I believe it is now correct.
Let $S$ be the set of sequences of natural numbers, almost all of which are zero. It is endowed with a function $\Sigma$ which returns the sum in a sequence. Let $M$ be the monoid of endomorphisms $T$ of $S$ such that $\Sigma(Ts) \leq \Sigma(s)$ for all $s \in S$.
Let $z$ be the "right shift operator" which inserts a 0 in the first slot of the sequence and shifts everything else to the right, and let $u$ be the left shift operator which shifts everything to the left (eliminating the number in the first slot).
Clearly $uzu = u$, and $u$ can't be invertible. I claim that $z$ is unique with this property; clearly any other element with this property must be a right shift operator inserting something in the first spot (one gets this immediately upon writing $uzu(a_0, \ldots) = (a_1, \ldots)$), and that something has to be 0 or the sum will increase.