I am curious if there is a class of colimits $\mathsf{colim} D$ where maps $A \to \mathsf{colim} D$ must factor through the colimit cocone $D(X) \to \mathsf{colim}D$ for some $X$?
For example, would this hold for directed or filtered colimits, or some other kind of colimit?
Your condition is equivalent to the condition that a given colimit is preserved by the Yoneda embedding $C\to [C^{\text{op}},\mathsf{Set}]$.
Indeed, suppose $D\colon I\to C$ is a diagram in the category $C$, with colimit $L = \varinjlim_{i\in I} D(i)$. Then to say that the colimit is preserved under the Yoneda embedding is to say that $$\text{Hom}(-,L) = \text{Hom}(-,\varinjlim D(i)) = \varinjlim \text{Hom}(-,D(i)),$$ i.e. for any object $X$, every arrow $X\to L$ factors through an arrow $X\to D(i)$ for some $i$.
This is a very strong condition to impose on a colimit. In particular, if it holds, then the identity map $\text{id}_L\colon L\to L$ factors through some $D(i)$, and in particular $L$ is a retract of $D(i)$.
This class of colimits does have a name: they are the absolute colimits, i.e. colimits in $C$ which are preserved by arbitrary functors out of $C$. The nLab page has a characterization here: a colimit is preserved by arbitrary functors if and only if it is preserved by the Yoneda embedding. And these conditions also have a more concrete characterization, one half of which is the statement that $L$ is a retract of some object $D(i)$ in the diagram.
For an explicit example of why not all directed/filtered colimits are absolute, just think about an arbitrary infinite set $X$ in the category of sets. $X$ is the directed colimit of its finite subsets, but the identity map $X\to X$ does not factor through any finite subset.
On the other hand, there is notion of a compact (also known as finitely presentable) object in a category, which is an object $A$ such that any map from $A$ to a filtered (equivalently directed) colimit factors through one of the objects in the colimit diagram. And in a locally finitely presentable category, there are enough compact objects so that every object is a filtered colimit of compact objects.