This is a statement about the homotopy category. Consider the following fact:
Let $X$ be an object in a category $C$ such that the corepresentable functor $h^X:C\to \operatorname{Set}$ factors through the forgetful functor $\operatorname{Grp}\to \operatorname{Set}$. Then these data precisely specify the diagrams you drew above but for natural transformations wrt the corepresentable functor $h^X$. By Yoneda, all of these natural transformations descend down to a cogroup structure on X in $C$ (so long as $C$ has enough coproducts).
So in particular, we know that in the homotopy category of based spaces $\operatorname{Ho}(\operatorname{Top}_\ast)$, the functor $\pi_1:\operatorname{Top}_\ast \to \operatorname{Grp}$ is corepresented by the corepresentable functor $h^{(S^1,\ast)}$ where $h^{(S^1,\ast)}(X,x)=[(S^1,\ast),(X,x)]=\pi_1(X,x)$, as desired.
Another example of a canonical cogroup that arises in this way is the group scheme $G_m$. This is the spectrum of the ring $\mathbb{Z}[x,x^{-1}].$
If you unwind what the corepresentable functor $h^{\mathbb{Z}[x,x^{-1}]}$ does on rings, you see that it sends a ring to its group of units. This then flips around to specify the cogroup structure by Yoneda on $\mathbb{Z}[x,x^{-1}]$