It is very important that you understand the difference between a static EM field and EM radiation.
You are talking about static EM fields (two electrons repelling), and photon mediation, but in reality these are virtual photons, just a mathematical model to describe the effects of the static field.
An electromagnetic field (also EMF or EM field) is a magnetic field produced by moving electrically charged objects. It affects the behavior of non-comoving charged objects at any distance of the field. The electromagnetic field extends indefinitely throughout space and describes the electromagnetic interaction. It is one of the four fundamental forces of nature (the others are gravitation, weak interaction and strong interaction).
Now in reality, at the QM level, you cannot imagine the virtual photons as classical billiard balls that fly between the two electrons, because then that will lead you to a confusing picture about attraction. How could you throw these billiard balls between an electron and a proton and get attraction? In reality you can't and at the QM level this is not how it works, virtual photons are not billiard balls.
In reality, we do not know how the static EM field around the electron and the proton (or two electrons) work, we just know their effects from experiments, and we describe this effect with virtual photons, a mathematical model.
We do know that electrons and protons (quarks) have an intrinsic property called EM charge, and from experiments we do know that like charges repel and opposite charges attract. But it would not be a real picture trying to describe this with small classical billiard balls flying inbetween, because the underlying world is QM.