Let $A$, $B$ be finite groups. Is it true that all short exact sequences $1 \rightarrow A \rightarrow A \times B \rightarrow B \rightarrow 1$ split on the right?

In other words, do there exist finite groups $A$, $B$ and homomorphisms $f: A \rightarrow A \times B$, $g: A \times B \rightarrow B$ such that $1 \rightarrow A \rightarrow A \times B \rightarrow B \rightarrow 1$ is exact and there does not exist a homomorphism $h: B \rightarrow A \times B$ such that $g \circ h = \text{id}_B$?

An example when $A$, $B$ are not finite is given by $A = \prod_{i=1}^\infty \mathbb{Z}$, $B = \prod_{i=1}^\infty \mathbb{Z}/2\mathbb{Z}$, $f((n_i)) = ((2n_i),0)$, and $g((n_i),(m_i)) = (\overline{n_1}, m_1, \overline{n_2}, m_2, \ldots)$.