Ok I checked the idea mentioned in the comments above.

As $X_n$ is a closed subspace of $X_M$ (use any degeneracy; it has a left inverse; composing both the other way round yields a projection and projections have closed images in the Hausdorff setting), it is enough to show, that $X_M$ is compact.

So consider the "generalized midpoint map"

$i: X_M\rightarrow \coprod_{n\le M} X_n\times \Delta^n\rightarrow |X|\qquad x\mapsto [x,c]$, where $c\in\Delta^M$ denotes the barycenter.

For example, if $M=2$ and $x$ is a nondegenerate one simplex in $X$, there are two degeneracies $s_0,s_1:X_1\rightarrow X_2$. Then one gets in |X|:

$i(s_0(x))=[s_0(x),\frac{1}{3},\frac{1}{3},\frac{1}{3}]=[x,\frac{2}{3},\frac{1}{3}]$

$i(s_1(x))=[s_1(x),\frac{1}{3},\frac{1}{3},\frac{1}{3}]=[x,\frac{1}{3},\frac{2}{3}]$

So in the realisation one really picks several midpoints of a simplex, that doesn't have maximal dimension.

But the map $i$ is still injective. Any simplex $x\in X_M$ might be written in a unique way as $x=s(y)$, where $y\in X_n$ is nondegenerate and $s$ is a degeneracy map (it corresponds to a surjective map $[M]\rightarrow [n]$ in $\Delta^{Op}$, $\Delta^{Op}$ can be identified with the category whose objects are the sets $\{0,\ldots,n\}$ and whose morphisms are nondecreasing maps).

Then $i(x)=[y,s(c)]=[y,\frac{s^{-1}(1)}{3},\ldots,\frac{s^{-1}(1)}{3}]$. Now the right side has normal form (There is a normal form for points in $|X|$. This can be found in every book about simplicial sets and it works the same way for simplicial spaces). Given any other $x'=s'(y')$ with $i(x)=i(x')$, we get

$[y,\frac{|s^{-1}(1)|}{M+1},\ldots,|\frac{s^{-1}(1)|}{M+1}]=[y',\frac{|s'^{-1}(1)|}{M+1},\ldots,\frac{|s'^{-1}(n)|}{M+1}]$. As this is in normal form, we get $y=y'$ and $|s'^{-1}(i)|=|s^{-1}(i)|$. But such nondecreasing maps are characterized by the size of the preimages, so $s=s'$ and hence $x=x'$. So the map $i$ is injective.

We still have to show, that $i$ is a homeo onto its image and that the image of $i$ is closed. Then $X_M$ is a closed subspace of a compact space and hence compact. Both will follow from the next claim:

For any closed subset $A\subset X_M$ the saturation $A'$ of $A\times \{c\}$ is still a closed subset of $\coprod_{n\le M} X_n\times \Delta^n$. This is an even worse calculation than the last one. One has to consider for each degeneracy map $s:X_N\rightarrow X_M$ the preimage $s^{-1}(A)\times \{s(c)\}$ and the set $B_s$ of all points that can be simplified to one of those points. Then one can show, that $B_s$ is closed and $A'=\bigcup_s B_s$. As there are only finitely many degeneracy maps (below dim $M$) this is a finite union and hence closed.