Let me answer your question in two steps.
Step one. The $\leqslant_\mathcal{L}$-preorder.
Let $M$ be a monoid. The notion you define is a relation (due to Green) known as the $\leqslant_\mathcal{L}$-preorder. It can be defined as follows:
$x \leqslant_\mathcal{L} y \iff Mx \subseteq My$.
This means that the left ideal generated by $x$ is contained in the left ideal generated by $y$. Equivalently
$x \leqslant_\mathcal{L} y \iff {}$there exists $z \in M$ such that $x = zy$.
The preorder $\leqslant_\mathcal{L}$ can be defined on any semigroup $S$. Let us denote by $S^1$ the monoid equal to $S$ if $S$ is a monoid and equal to $S \cup \{1\}$, where $1$ is an identity for $S$,
if $S$ is not a monoid. Then the definition is modified as follows
$x \leqslant_\mathcal{L} y \iff S^1x \subseteq S^1y \iff {}$ there exists $z \in S^1$ such that $x = zy$.
The preorder $\leqslant_\mathcal{L}$ is part of the Green's relations, which are thoroughly studied in any textbook on semigroup theory.
Step two. What can be said about the $\leqslant_\mathcal{L}$-preorder?
Consider the case you are interested in, or more generally the monoid $T(X)$ of all functions from a set $X$ to itself, under composition. Given $f \in T(X)$, let
$$
\ker(f) = \{(x,y) \in X^2 \mid f(x) = f(y) \}
$$
I claim that
$f \leqslant_\mathcal{L} g$ if and only if $\ker(g) \subseteq \ker(f)$.
Indeed, if $f = h \circ g$ and $g(x) = g(y)$, then $f(x) = f(y)$. For the opposite direction, it suffices to adapt your argument as follows: if $\ker(g) \subseteq \ker(f)$, then the relation $h = f \circ g^{-1}$ is actually a function such that $f = h \circ g$.
Since any monoid $M$ is isomorphic to a submonoid of $T(M)$, it is tempting to generalize this result to arbitrary monoids, which leads to the following question: if $S$ is a subsemigroup of $T$, what are the connections between the preorders $\leqslant_\mathcal{L}$ on $S$ and on $T$? Let me indicate a partial result in this direction:
Let $T$ be a subsemigroup of a semigroup $S$ and let $s, t \in T$ with
$t$ regular in $T$. If $s \leqslant_\mathcal{L} t$ in $S$, then $s \leqslant_\mathcal{L} t$ in $T$.
A similar result holds without any regularity assumption in two cases: when $S$ is an ideal of $T$ and when $S$ is a local subsemigroup of $T$.
Let $T$ be an ideal of a semigroup $S$ and let $s, t \in T$. If $s \leqslant_\mathcal{L} t$ in $S$, then $s \leqslant_\mathcal{L} t$ in $T$.
Let $e$ be an idempotent of a semigroup $S$ and let $T = eSe$. If two
elements $s$ and $t$ of $T$ satisfy $s \leqslant_\mathcal{L} t$ in
$S$, then $s \leqslant_\mathcal{L} t$ in $T$.