Let $\phi: B \rightarrow P$ and $B \simeq P \oplus ker~\phi$.
Claim that $B = P' \oplus ker~\phi$ where $P' \simeq P$.
Proof: There is a map $g: B \rightarrow P \oplus ker~\phi$. Let
$P' = \{ y - \pi_2(g(y)) : y \in B \}$. Then because $\pi_2(g(y)) \in ker~\phi$
and $\phi(y) = \phi(y - \pi_2(g(y)) + \pi_2(g(y)) ) = \phi(y - \pi_2(g(y)))$,
then $\phi$ maps $P'$ onto $P$ since $\phi : B \rightarrow P$ is surjective.
Every element $y \in B$ is a sum of an element of $P'$ and an element
of $ker~\phi$ because $y = y - \pi_2(g(y)) + \pi_2(g(y))$.