Here's, for any positive integer $k$, a second countable, compact group, of dimension $k$, whose zero connected component is not a topological direct factor.
Let $I$ be any infinite set of primes (all primes if you like). Consider $G=\prod_{i\in I}\mathbf{Z}/p\mathbf{Z}$. This is an abelian group, whose torsion subgroup is $\bigoplus_{i\in I}\mathbf{Z}/p\mathbf{Z}$, and the quotient is a torsion-free divisible abelian group, hence isomorphic to some $\mathbf{Q}$-vector space of uncountable dimension. Choose any integer $k>0$, and pick a subgroup of the latter quotient, isomorphic to $\mathbf{Q}^k$, and let $H$ be its inverse image in $G$. (With some little effort, one can construct explicitly such $H$.)
So the torsion subgroup in $H$ is $\bigoplus_{i\in I}\mathbf{Z}/p\mathbf{Z}$, and the quotient by the torsion is isomorphic to $\mathbf{Q}^k$. This is not splittable as direct product of torsion and torsion-free, since $H$ is residually finite and $\mathbf{Q}$ is not.
Let $K$ be the Pontryagin dual of the discrete group $H$, let $S$ be the Pontryagin dual of $\mathbf{Q}$ (this is a connected, 1-dimensional, torsion-free compact group). Then $K$ admits $S^k$ as closed subgroup (equal to its 0 connected component), and the quotient is topologically isomorphic to the Pontryagin dual of $\bigoplus_{i\in I}\mathbf{Z}/p\mathbf{Z}$, namely $G$ itself (viewed now as topological group, profinite). This is not part of a splitting as topological direct product, because it was not the case at the dual level.