$G/Z$ cannot be isomorphic to quaternion group
$Q_8$ has cyclic subgroups of index $2$, such as $\langle i\rangle$ and $\langle j\rangle$. Their inverse images in $G$ are of index $2$ and their respective centres contains at least the centre $Z$ of $G$. Hence their quotient by their centre is cyclic and finally $\pi^{-1}(\langle i\rangle)$ and $\pi^{-1}(\langle j\rangle)$ are abelian (cf. Jykri Lahtonen's comment). Select $g\in G$ with $\pi(g)=-1$. Then $g\in \pi^{-1}(\langle i\rangle)\cap \pi^{-1}(\langle j\rangle)$, hence it commutes with all elements of $\pi^{-1}(\langle i\rangle)$ and all elements of $\pi^{-1}(\langle j\rangle)$, therefore also with all elements of $\pi^{-1}(\langle i,j\rangle)=\pi^{-1}(Q_8)=G$, contradicting $g\notin Z$.