Submonoid of free monoid with certain properties Let $N$ be a submonoid of a free monoid $M$ such that
$m_1nm_2\in N \Rightarrow m_1,m_2\in N$ for any $m_1,m_2\in M$ and $n\in N\setminus\{1\}$.       $\quad\quad\quad\quad$     (C)
Do such submonoids $N$ have a name?
 A: Let $N$ be a submonoid of a free monoid $M$. Recall that $N$ has a unique minimal generating set, denoted by $\min(N)$, namely $(N\setminus 1) \setminus (N \setminus 1)^2$. According to Berstel-Perrin-Reutenauer, $N$ is right unitary (resp. left unitary, biunitary) if and only if $\min(N)$ is a prefix code (resp. suffix code, bifix code). If I haven't made a mistake, then $N$ satisfies the condition (C) in my question if and only if $\min(N)$ is a "cover code", meaning that one cannot cover a word in $\min(N)$ by  words in $\min(N)$ in a nontrivial way (see the Definition below).
Definition Let $X^*$ be the set of finite words over some alphabet $X$ and $W\subseteq X^*$ a subset. Define a cover of a word $w\in W$ as a tuple $(w_1,\dots, w_k,\alpha,\beta)$ where $w_1,\dots,w_k\in W$ and $\alpha,\beta\in X^*$, such that $$\alpha w \beta=w_1\dots w_k, ~~~|w_1|>|\alpha|,~~~|w_k|>|\beta|.$$ Call a cover $(w_1,\dots,w_k,\alpha,\beta)$ of $w$ trivial if $k=1$, $w_1=w$ and $\alpha=\beta=1$. The set $W$ is a cover code if every $w\in W$ can only be covered trivially.
Lemma Let $N$ be a submonoid of a free monoid $M=X^*$. Then $N$ satisfies condition (C) if and only if $\min(N)$ is a cover code.
Proof ($\Rightarrow$) Suppose $N$ satisfies (C). Let $w\in \min(N)$ and $(w_1,\dots,w_k,\alpha,\beta)$ a cover of $w$. Since $N$ satisfies (C), we have $\alpha,\beta\in N$. Hence $\alpha=w_{\alpha,1}\dots w_{\alpha,r}$ and $\beta=w_{\beta,1}\dots w_{\beta,s}$ for some $w_{\alpha,i},w_{\beta,j}\in \min(N)$. Since $N$ satisfies (C), no word in $\min(N)$ has a proper subword lying in $N$. It follows, that
$$w_1=w_{\alpha,1},~\dots ~, w_r=w_{\alpha,r},~ w_{r+1}=w,~w_{r+2}=w_{\beta,1},~\dots~, w_k=w_{\beta,s}.$$
Since $|w_1|>|\alpha|$ and $|w_k|>|\beta|$, it follows that $\alpha=\beta=1$ and moreover that $k=1$ and $w_1=w$, i.e. $(w_1,\dots,w_k,\alpha,\beta)$ is trivial.
($\Leftarrow$) Suppose that $\min(N)$ is a cover code. Let $m_1,m_2\in M, n\in N\setminus\{1\}$ such that $m_1nm_2\in N$. Write $$n=w_{n,1}\dots w_{n,k}~\text{ and }~m_1nm_2= w_1\dots w_l$$ where $w_{n,1},\dots, w_{n,k},w_1,\dots, w_l\in \min(N)$. Let the integer $p$ be maximal with the property $|w_1\dots w_p|\leq|m_1|$. Then there is a $q\geq p+1$ and $\alpha,\beta\in M$ such that $(w_{p+1},\dots,w_{q},\alpha,\beta)$ is a cover of $w_{n,1}$. Since $\min(N)$ is a cover code, it follows that $q=p+1$ and $w_{p+1}=w_{n,1}$. Hence there is a $q'\geq p+2$ and $\alpha',\beta'\in M$ such that $(w_{p+2},\dots,w_{q'},\alpha',\beta')$ is a cover of $w_{n,2}$. It follows that $q'=p+2$ and $w_{p+2}=w_{n,2}$. Proceeding like this we get
$$n=w_{n,1}\dots w_{n,k}=w_{p+1}\dots w_{p+k}.$$
It follows that $m_1=w_1\dots w_p,~m_2=w_{p+k+1}\dots w_{l}\in N$. Thus $N$ satisfies condition (C).$~~\quad\Box$
Examples Let $X=\{a,b\}$ and $M=X^*$. Let
$$N_1=\langle aa\rangle,~~ N_2=\langle ab\rangle,~~ N_3=\langle ab, ba, bba\rangle.$$
Note that $\min(N_1)=N_1$, $\min(N_2)=N_2$ and $\min(N_3)=N_3$. $N_1$ does not satisfy condition (C) since $(aa,aa,a,a)$ is a nontrivial cover of $aa$. $N_2$ satisfies condition (C) since $ab$ has no nontrivial cover. $N_3$ does not satisfy condition (C) since $(ab,ba,a,1)$ is a nontrivial cover of $bba$.
