Let $\rightarrowtail$ denote a monomorphism.
Given a morphism $A \stackrel{j}{\to} B$, I am interested in the (not necessarily unique) existence of a factorization $A \stackrel{j'}{\rightarrowtail} X \stackrel{s}{\to} B$ of $j$ (so $j = s \circ j'$) such that for any other factorization $A \stackrel{i}{\rightarrowtail} Y \stackrel{t}{\to} B$ of $j$, there exists a morphism $Y \stackrel{t'}{\to} X$ with $j' = t' \circ i$ and $t = s \circ t'$. A commutative diagram for the required morphisms.
In $\mathbf{Set}$, such an $X$ can be obtained by constructing the coproduct $A + B$, and appropriately defining the morphisms. In $\mathbf{Graph}$ also a construction exists, by taking $A + B$ and enriching the graph with additional edges.
Intuitively, one can think of $B$ as a type object for $A$, and I am looking for an alternative type object $X$ that preserves subobject $A$, but in some sense does not lose instances $Y$ of $B$.
Are there related constructions in the literature? And what are sufficient conditions for such an $X$ to exist? Any pointers would be greatly appreciated.