Examples for the fact that a pullback of an epimorphism is not necessarily an epimorphism.
This is supposed to be an answer to a tiny fraction of your question: In $\mathsf{Grp}$ epis are stable under pullbacks (therefore you can stop searching for a counterexample there).
This is because in $\mathsf{Grp}$ every epi is regular and regular epis are stable under taking pullbacks, because $\mathsf{Grp}$ (and more generally every category of universal algebras) is a regular category.
The same applies for example to $\mathsf{Set}$ and to every abelian category, in particular $R\mathsf{Mod}$ for every ring $R$.
Actually, in a (concrete) category of universal algebras $(\mathcal{A}, U : \mathcal{A} \to \mathsf{Set})$ a morphism is a regular epi if and only, if it is surjective (its underlying function is surjective). We can conclude, that the following are equivalent for $\mathcal{A}$:
- every epi is regular ("epi $=$ regular epi")
- every epi is surjective ("epi $=$ surjective")
- $\mathcal{A}$ is balanced ("mono & epi $\Rightarrow$ iso")
Hence, every concrete "algebraic" category satisfying one of the equivalent conditions above is off the table for counterexamples (again: regular epis are stable under pullbacks in a regular category)
An example in $\mathsf{Ring}$ is the inclusion $\mathbb{C}[t]\to\mathbb{C}[t,t^{-1}]$, which is an epimorphism, but whose pullback along $\mathbb{C}[t^{-1}]\to\mathbb{C}[t,t^{-1}]$ is $\mathbb{C}\to\mathbb{C}[t^{-1}]$, which is not an epimorphism.
However, every pullback of $\mathbb{Z}\to\mathbb{Q}$ is an epimorphism. There's a proof in the answer to this related question.