Everything you say is correct: the sense that a finite group is "built" from its simple Jordan-Hölder factors is by repeated extensions. But this "building" process is much more complicated for groups than the analogous process of building integers from prime numbers because given a (multi-)set of building blocks -- i.e., a finite list $\mathcal{H} = \{ \{H_1,\ldots,H_n\} \}$ of finite simple groups -- there will be in general several (finitely many, obviously, but perhaps a large number) nonisomorphic groups $G$ with
composition factors $\mathcal{H}$. The simplest example of this has already been given by Zhen Lin in a comment: if
$\mathcal{H} = \{ \{ C_2, C_2 \} \}$,
then the two groups with these composition factors are $C_4$ and $C_2 \times C_2$.
It seems to be a working assumption of experts in the field that it is hopeless to expect a nice solution to the extension problem. For instance, consider the special case $\mathcal{H} = \{ \{ C_p,\ldots,C_p \} \}$, in which every composition factor is cyclic of order $p$ -- i.e. a finite $p$-group. It is known that the function $f(p,n)$ which counts the number of isomorphism classes of finite groups of order $p^n$ grows very rapidly as a function of $n$ for any fixed $p$. For instance, see here for a reference to the fact that $f(2,9) = 10494213$.
Nevertheless the group extension problem is an important and interesting one -- it is one of the historical sources for the field of group cohomology and still plays a major role -- and in many special cases one can say something nice. But the general "program" of classifying all finite groups by (i) classifying all simple groups and (ii) determining all finite groups with a given set $\mathcal{H}$ of composition factors does not seem realistic: step (i) was amazingly hard but in the end doable. It looks very easy compared to step (ii)!
Finally, you ask about infinite groups. Here the Jordan-Hölder theory extends precisely to groups $G$ which admit at least one composition series, and a standard (necessary and sufficient) criterion for this is that there are no infinite sequences of subgroups
$H_1 \subsetneq H_2 \subsetneq \ldots$
with each $H_i$ normal in $H_{i+1}$
or
$H_1 \supsetneq H_2 \supsetneq \ldots$
with each $H_{i+1}$ normal in $H_i$.
So for instance an infinite cyclic group $\mathbb{Z}$ does not satisfy the descending chain condition on subgroups and there is no sense (known to me, at least) in which $\mathbb{Z}$ is built up out of simple groups.
Rotman's Introduction to the Theory of Groups (theorem 6.9 on page 130) contains such a proof, attributed to Schenkman, but this proof is not exactly as I have outlined in the question.
The book The Theory of Finite Groups: An Introduction, by Kurzweil and Stellmacher, does what I had in mind in Chapter 2.
Best Answer
This is a good question.
I think historically, the hope in light of the Jordan-Holder Theorem, was that we would be able to understand/classify finite groups by doing two things:
Now, it turned out that part 1 was hard (as witnessed by the Classification of Finite Simple Groups) but doable; but 2 is really hard.
Now, there is a class of cases where one can actually accomplish part 2 above pretty well, and it includes the case in which the normal subgroup is abelian; and even more so when the normal subgroup is central, which is the case here.
The basic idea is that we need an extra piece of information to construct the multiplication table. Just like we need an extra piece of information to construct a semidirect product $N\rtimes Q$ (namely, a morphism $\theta\colon Q\to\mathrm{Aut}(N)$) now we need an additional piece of information because when $1\to N\to G\to Q\to 1$ is our decomposition, there may be no subgroup of $G$ isomorphic to $Q$ to intersects $N$ trivially (as is the case in your situation, where $N=C_2$, $Q=C_2$, and we want $G$ to be $C_4$).
This is accomplished by the use of cocycles and cohomology. You can find an exposition of this in Rotman's Introduction to the Theory of Groups; in the 4th Edition, it is Chapter 7.
Briefly: assume that you already have a group $G$ with a normal subgroup $N$ and quotient $G/N = Q$. We can define a function $\ell\colon Q\to G$ with the property that $\pi\ell=\mathrm{id}_Q$, where $\pi$ is the canonical map $G\to G/N=Q$. If we can pick this map to be a group homomorphism then we get a semidirect product. But in general, we will have that $\ell(xy)\neq \ell(x)\ell(y)$ for $x,y\in Q$. So we need a "correction factor" that keeps track of this issue.
Explicitly, given an abelian group $N$ written additively, a group $Q$, a morphism $\theta\colon Q\to \mathrm{Aut}(N)$, we say that a function $f\colon Q\times Q\to N$ is a cocycle if and only if:
The second condition looks complicated, but it essentially comes from the following: we will define a group operation on $N\times Q$, but this operation will not satisfy $(0,x)\cdot (0,y) = (0,xy)$ in general, because it's not going to be a semidirect product. Instead, it will be given by $(0,x)\cdot (0,y) = (f(x,y),xy)$ (that's the "correction factor"). The identity in 2 above is precisely what is required to make sure that the resulting product is associative.
So given $N$, $Q$, $\theta\colon Q\to\mathrm{Aut}(N)$, and a cocycle $f$, we define a group $G$ which is an extension of $N$ by $Q$, as follows:
The underlying set of $G$ is $N\times Q$, ordered pairs $(a,x)$ with $a\in N$ and $x\in Q$.
The operation $\cdot$ on $G$ is the following: $$(a,x)\cdot(b,y) = (a+\theta(x)(b) + f(x,y), xy).$$
The cocycle identity ensures this is associative. The identity element is $(0,1)$. The inverse of $(a,x)$ is $$(-\theta(x^{-1})(a) - \theta(x^{-1})f(x,x^{-1}),x^{-1}).$$
Note that $N$ lies in the center of the resulting group if and only if $\theta$ is the trivial map, in which case the cocycle identity simplifies to $$f(y,z)-f(xy,z)+f(x,yz)-f(x,y) = 0.$$ Then the operation on the ordered pairs simplifies to $$(a,x)\cdot(b,y) = (a+b+f(x,y),xy)$$ and the inverse to $$(a,x)^{-1} = (-a-f(x,x^{-1}),x^{-1}).$$
Now, in our case we have $N=C_2=\{0,x\}$, and $Q=C_2=\{1,y\}$. The action is trivial, because $N$ is central, so we are in the "easy" situation above.
Define $f\colon Q\times Q\to K$ by $f(1,1)=f(1,y)=f(y,1)=0$ and $f(y,y)=x$. This satisfies the cocycle identity $$f(b,c)-f(ab,c)+f(a,bc)-f(a,b)=0.$$ Then the resulting group $(K\times Q,\cdot)$ is the cyclic group of order four. Indeed, it is generated by $(0,y)$: $$\begin{align*} (0,y)^2 = (0,y)\cdot (0,y) &= (0+0+f(y,y),y^2) = (x,1)\\ (0,y)^3 = (x,1)\cdot(0,y) &= (x+0+f(1,y),y) = (x,y)\\ (0,y)^4 = (x,y)\cdot(0,y) &= (x+0+f(y,y),y^2) = (x+x,1) = (0,1). \end{align*} $$ and so we have realized $C_4$ as a group on $K\times Q$ with the help of the cocycle $f$.