No, such a homomorphism is not possible. The prototypical nature of the Griffiths twin cone is what is needed for the proofguarantees this.
Let $X,Y$ be contractible with basepoints $x,y$ respectively. We only need to assume $\{x\}$ and $\{y\}$ are closed. Let $X\vee Y$ be the wedge with basepoint $\ast$.
Suppose $h:\pi_1(X\vee Y)\to \mathbb{Z}$ is non-trivial. Pick a loop $\alpha$ in $X\vee Y$ based at $\ast$ such that $h([\alpha])\neq 0$. Consider the set $\mathscr{L}$ of components of $[0,1]\backslash \alpha^{-1}(\ast)$ with the natural ordering inherited from $[0,1]$.
Let $\mathscr{L}_X$ be the set of components $(a,b)$ of $[0,1]\backslash \alpha^{-1}(\ast)$ such that $\alpha([a,b])\subseteq X$.
Let $\mathscr{L}_Y$ be the set of components $(c,d)$ of $[0,1]\backslash \alpha^{-1}(\ast)$ such that $\alpha([c,d])\subseteq Y$.
Since $X$ and $Y$ are both simply connected, in order to have $[\alpha]\neq 1$, both $\mathscr{L}_X$ and $\mathscr{L}_Y$ must be infinite. Choose enumerations $\mathscr{L}_X=\{(a_1,b_1),(a_2,b_2),...\}$ and $\mathscr{L}_X=\{(c_1,d_1),(c_2,d_2),...\}$. Let $\mathbb{H}$ be the Hawaiian earring and $\ell_n$ be the standard loop traversing the n-th circle. Let $\mathbb{H}_{odd}$ and $\mathbb{H}_{even}$ be the sub-Hawaiian earrings consisting of the odd and even indexed circles respectively.
Construct a map $f:\mathbb{H}\to X\vee Y$ such that $f \circ \ell_{2n-1}= \alpha|_{[a_n,b_n]}$ and $f\circ \ell_{2n}= \alpha|_{[c_n,d_n]}$ after reparameterization. Using the enumerations and ordering of $\mathscr{L}$, it is easy to build a loop $\beta:[0,1]\to \mathbb{H}$ such that $f\circ\beta$ is a reparmeterization of $\alpha$.
Since $\mathbb{H}=\mathbb{H}_{odd}\vee \mathbb{H}_{even}$, $f(\mathbb{H}_{odd})\subseteq X$, and $f(\mathbb{H}_{even})\subseteq Y$ where $X$ and $Y$ are contractible, $f$ extends to a map $g:\mathbb{G}=C\mathbb{H}_{odd}\vee C\mathbb{H}_{even}\to X\vee Y$ (where $C$ is the cone and $\mathbb{G}$ is the Griffiths twin cone from the question). Recalling the fact $Hom(\pi_1(\mathbb{G}),\mathbb{Z})=0$ from the question, we see that the composition $h\circ g_{\#}:\pi_1(\mathbb{G})\to\mathbb{Z}$ is trivial; However, if $i:\mathbb{H}\to\mathbb{G}$ is inclusion, then $h\circ g_{\#}(i_{\#}([\beta]))=h([\alpha])\neq 0$; a contradiction.