To elaborate Andreas Thom's comment into an answer:

Yes, this construction works, proof below. Also, you seemed unhappy about the equivalence relation involving universal quantification over possible compact images. Fortunately, it is possible to describe it solely in terms of the topology on $X$.

*A note on the space of ultrafilters.*

Let $X$ be a topological space and let $pX$ denote its space of ultrafilters, i.e. the Stone-Čech compactification of $X$ *with the discrete topology*. For any (not necessarily continuous!) map $f : X \to Y$ to a compact space $Y$, there exists a unique continuous map $\tilde f : pX \to Y$, which is given by

$$ \tilde f(p) = \lim_{x \to p} f(x) .$$

*Equivalence relation on ultrafilters.*

We want two ultrafilters $p,p'\in pX$ to be equivalent if they cannot be distinguished by continuous functions into compact spaces, i.e.

$$ p \approx p' \iff \lim_{x \to p}\ g(x) = \lim_{x \to p'}\ g(x) \quad\text{for all continuous } g:X\to C .$$

This definition is somewhat unsatisfactory, since it doesn't refer to the topology of $X$ directly. Fortunately, we can use the following equivalence relation instead: two ultrafilters are considered equivalent if they cannot be "separated" by closed sets

$$ p \sim p' \iff (A \in p \wedge A'\in p' \Longrightarrow A\cap A' \in p \wedge A'\cap A \in p') \text{ for all closed sets } A,A'\subseteq X .$$

This relation might identify fewer ultrafilters than the old one, but we still have that $p \not\approx p'$ implies $p \not\sim p'$. After all, if two ultrafilters $p$ and $p'$ have different limits in some compact image $C$, then we can separate the points $g(p)$ and $g(p')$ by disjoint *closed* sets, for instance by using Uryson's lemma on the quasicompact Hausdorff space $C$. Pulling back these closed sets shows that $p \not\sim p'$.

*$\beta X$ as quotient*

We denote the quotient space with $\beta X := pX / \sim$. It's easy to see that it has the universal property, after all, every map $g:X \to C$ lifts to a unique, continuous map $\tilde g : pX \to C$, but since $g$ is continuous, its lifting also factors through the quotient $\beta X$.

To finish the proof that $\beta X$ is the universal compactification, we have to show that $\beta X$ is compact and that the natural map $\iota : X \to \beta X$ is continuous.

*$\beta X$ is quasicompact and Hausdorff*

As a quotient of a compact space, the space $\beta X$ is quasicompact.

By definition, any two ultrafilters $p \not\sim p'$ can be distinguished by a continuous function $\tilde g : pX \to C$ into a compact space $C$. But $C$ is Hausdorff and we can pull back open neighborhoods from $C$.

*The natural map is continuous*

This is the hardest part, but it's not too bad. We show that preimages of closed sets are closed.

Let $B\subseteq \beta X$ be a closed set and $A = \iota^{-1}(B)$ be its preimage. Let $\bar A \subseteq X$ be the closure in $X$ and let $y\in \bar A \setminus A$ be a point on the boundary. We have to show that its image $\iota(y)$ is already a member of $B$.

We construct two ultrafilters $p_y$ and $q_y$ as follows:

$p_y := $ the principal ultrafilter on $y$.

$q_y := $ some ultrafilter that contains all open neighborhoods of $y$ and the set $A$. This is possible because the point $y$ is from the boundary of $A$, which means that all open neighborhoods of $y$ have nonempty intersection with the set $A$. (Use Zorn's lemma to upgrade the filter generated by these sets to an ultrafilter.)

The key point is that the ultrafilters $p_y$ and $q_y$ converge to the same point $y$ and thus cannot be distinguished by continuous functions from $X$ to some other space, i.e. $p_y \approx q_y$. Alternatively, all closed sets in $q_y$ must contain the point $y$ and we also have $p_y \sim q_y$.

Hence, both ultrafilters are equal in the quotient $\beta X$,

$$ \iota(y) = [p_y] = [q_y] .$$

Using the note above and applying it to $\iota$, we can write this as

$$ \iota(y) = \lim_{x \to p_y} \iota (x) = \lim_{x \to q_y} \iota (x) .$$

But the latter limit must be a member of the set $B$! Otherwise, by the definition of the limit along an ultrafilter, the preimage $A^c =\iota^{-1}(B^c)$ of the open complement $B^c$ would be a member of the ultrafilter $q_y$, which contradicts $A\in q_y$.