There is also a character-theoretic argument. Suppose $G' \cap Z(G)$ has a subgroup $U$ of order $p$. We want a contradiction. Let $\lambda$ be a nonprinciipal linear character of $U$. Since $U \subseteq P$ and $P$ is abelian, $\lambda$ has an extension to $\mu$, a linear character of $P$. The induced character $\mu^G$ has degree $|G:U|$, which is prime to $p$, so some irreducible constituent $\chi$ of $\mu^G$ has degree not divisible by $p$. Then $\mu$ is a constituent of the restriction $\chi_P$ by Frobenius reciprocity, and thus $\lambda$ is a constituent of $\chi_U$. But $U$ is central, so $\chi_U = \chi(1)\lambda$. Now let $\sigma$ be the linear character det$(\chi)$. Then $\sigma_U = \lambda^{\chi(1)}$, which is nontrivial since $p$ does not divide $\chi(1)$. This is a contradiction, however, since $U \subseteq G' \subseteq {\rm ker}(\sigma)$. [Note that transfer proofs can often be replaced by arguments using the determinant of a character.]