I have asked a similar question elsewhere:
what happens to the Stone-Cech compactification if you change “compact Hausdorff” to “$T_1$ compact”? Here, I've added $T_1$ as opposed to this. Is $K$ there $T_1$ or at least $T_0$ ? In other words, does this modified thing always exist ?
The answer is negative and has essentially already been established by Eric Wofsey. Following his construction almost exactly we assume that $X$ is a noncompact $T_1$ space and $f:X\rightarrow Y$ is a map into a compact $T_1$ space $Y$ through which any map $X\rightarrow Z$ into a compact $T_1$ space factors uniquely. Note that $X$ necessarily has infinitely many points.
Let $\widetilde K=X\sqcup\{a,b\}$ and topologise it by giving it the base of open sets generated by $i)$ the open subsets $U\subset X$, $ii)$ the sets $U=(X\setminus F)\cup\{a\}$ where $F\subseteq X$ is finite, $iii)$ the sets $U=(X\setminus G)\cup\{b\}$ where $G\subseteq X$ is finite, and $iv)$ the sets $U=(X\setminus H)\cup\{a,b\}$, where $H\subseteq X$ is finite.
Then $\widetilde K$ is compact $T_1$ so accepts a map $g:Y\rightarrow \widetilde K$ which is uniquely determined by the inclusion $i:X\hookrightarrow \widetilde K$. Let $\theta:\widetilde K\rightarrow\widetilde K$ be the map $$\theta(x)=\begin{cases}x&x\in X\\b&x=a\\a&x=b.\end{cases}$$ Then $\theta$ is a homeomorphism satisfying $\theta i=i$. On the other hand the two maps $\theta g$ and $g$ are necessarily distict extensions of $i$. The full argument for this is that of Wofsey already cited above.
Replacing $T_1$ with $T_0$ everywhere above we see also that there are no initial maps into compact $T_0$ spaces. Similarly $T_1$ can be replaced by $T_D$ to arrive at the same conclusion for compact $T_D$ spaces.
Here is some discussion. Our argument hinged on two assumptions; $1)$ That $X$ is $T_1$, $2)$ that $f:X\rightarrow Y$ is a closed embedding.
It is easy to see that the second assumption causes no harm, and we can even assume without loss of generality that this embedding is dense. More subtle is the first assumption.
Now the full subcategory of $T_1$ spaces is extremal epireflective in $Top$. Thus for each space $X$ there is a $T_1$ space $X_1$ and a quotient surjection $X\rightarrow X_1$ through which any map $X\rightarrow Y$ into a $T_1$ space $Y$ will factor uniquely. This is all true for abstract reasons. Namely because the property of being $T_1$ is both productive and hereditary. The space $X_1$ can be realised as the quotient $X/\sim$, where $\sim$ is the intersection of all the closed equivalence relations on $X$.
Clearly if $X$ is compact, then so is $X_1$.
Of course by the same line of reasoning any space $X$, compact or not, for which $X_1$ is compact will have a reflection in compact $T_1$ spaces. As an example let $X=[0,\infty)$ topologised with the base of open sets $\{[0,x)\}_{x\in[0,\infty)}$. Then $X$ is a noncompact $T_0$ space which fails to be $T_1$, and its $T_1$ reflection $X_1=\ast$ is a singleton.
This is all elementary and included only to indicate that the situation is more interesting than a blanket negative answer. It is also the setup required to verify that our restriction to $T_1$ spaces did no harm.
Of course if I knew how to answer this I would not pose it as a question.