The only group $G$ with one $A$ and one $B$ as composition factors is $G = A\times B$ (where $A$ and $B$ are non-abelian, finite and simple)

The answer to the question is yes, the only group with two nonabelian finite simple groups $A$ and $B$ as composition factors is the direct product $A \times B$.

The well-known Schreier Conjecture says that the outer automorphism group of any finite nonabelian simple group is solvable. The conjecture was finally confirmed by the Classification of Finite Simple Groups (of course it would have been much nicer if there a direct proof had been found).

So, in any semidirect product $A \rtimes_\phi B$, for a homomorphism $\phi:B \to {\rm Aut}(A)$, we must have ${\rm Im}(\phi) \le {\rm Inn A}$, and hence $A \rtimes_\phi B \cong A \times B$.

The smallest finite group in which all composition factors are nonabelian and which is not a direct product of simple groups is the wreath product $A_5 \wr A_5 \cong A_5^5 \rtimes A_5$of order $60^6$.


Here's an argument that doesn't assume that the extension is split. WLOG, let $A$ be a normal subgroup of $G$, with quotient isomorphic to $B$, both $A$ and $B$ being nonabelian simple (and everything finite).

Let $C$ be the centraliser of $A$ in $G$. Since $A$ is normal in $G$, so is $C$. Note also that $A\cap C=1$ hence $AC=A \times C$. It also follows that $C$ is isomorphic to a normal subgroup of $B$, so either $C=1$ or $C\cong B$. In the latter case, we get $G\cong A\times B$, as required. Otherwise, $C=1$ and by the N/C Theorem, $G$ embeds in $\mathrm{Aut}(A)$. In fact, a variation of this argument yields that $G/A$ embeds in $\mathrm{Out}(A)$. Now, as Derek pointed out, this $\mathrm{Out}(A)$ is soluble (by the Schreier Conjecture), which is a contradiction.