While I think your question may be problematic to some because they are very weary of the "why" question, because physics can only go so deep, I recognize that it is hard to just accept a causal relationship between things that seem arbitrarily related, so lets try to look deeper.
A magnetic field is caused by a moving electric charge correct? The moving electric charge causes an increase in the electric field in front of it and a decrease in the electric field in back of it, and these changes create a magnetic field, but let's go back to the charge.
Let's imagine that this charge is moving extremely fast, at relativistic speeds even. Next to it and parallel to its motion is an infinitely long wire with current flowing through it, a lot of current too. Let's say that the electrons in this wire are moving just as fast as the electron, and in the same direction. We could even imagine them with race helmets on, racing each other off to infinity.
Now this wire is electrically neutral, for every electron in the wire there is a proton, so the electron traveling alongside should feel no pull towards the wire or a push away. However, this is all from our perspective. To us the electrons are moving fast, but what about to them?
According to relativity, they have every right to say that they are not moving. What looked like racing hats to us were actually top hats, and they were sitting down having some tea while we zoomed by at nearly the speed of light. Now we would look sort of funny, because the effects of relativity cause us to look squashed. This is important, because we would not be the only things zooming past the electrons.
The protons in the wire as well would be zooming past them as well. The same relativistic squashing happens with them, but this time it's more important. The relativistic length contraction not only squishes the protons, but because it is a whole column of protons moving past them, the column squishes as well, increasing the positive charge density of the wire. The electron feels the effect of this increased charge density as a pull inwards and so it drifts closer to the wire.
We see this in our frame as well and are perplexed, why would the electron feel a pull from the wire? We see no excess charge in the wire, so we ascribe this effect to a different force, the magnetic force. However, from the electrons reference frame, this behavior is perfectly normal, the protons moving past him are closer together than the electrons standing still and the electric force from the wire pull him closer.
This is kind of what magnetism is, electricity's compensation for relativity. For if magnetism didn't exist, we would see the electron attracted to the wire, for no explainable reason. Magnetism is sort of the relativistic form of electricity.
As for them interacting and causing each other, this must happen or else other laws of physics could possibly be broken (or you would have a meaningless thing like a force from nothing). This is a comforting example of how a part of physics holds itself up by itself.
There is a difference between your two cases. When you are talking about a charge passing between magnets you are thinking of it as a uniform magnetic field. But it is not uniform, it gets stronger as you approach the magnets. if it were a uniform field the magnetic dipole you put in the middle would not feel a force along the line of the magnets, although it would still experience a torque.
To see where the force along the magnets comes from, imagine a single charge moving in a circle with velocity always perpendicular to the line of the magnets. If it were a uniform magnetic field the Lorentz force would act perpendicular to the line of the magnets producing an outward radial force. This is what you realized.
But really the field is getting weaker as you go away from the magnets, and since the magnetic field has no divergence that means the field lines must expand outward as you go away from the magnets. You see this on any diagram of the magnetic field of a dipole. So if you look at what the Lorentz force on the charge moving in a circle is now the the magnetic field has a (possibly small) component outwards you will see the charge picks up a force along the line of the magnets (in addition to the original force outward).
Best Answer
The exact geometry of your proposed solution is unclear. However, the simple fact is that the electric and magnetic fields must be perpendicular to each other and to the velocity of the electron beam to achieve the desired zero deflection.
This diagram illustrates the forces exerted by a magnetic field on a beam of charged particles, using the right hand to create a set of orthogonal axes:
[]
Unfortunately, the diagram is for a beam of positive charges. To apply this method to beam of electrons, simply use your left-hand, or use your right hand and remember to reverse the direction of the magnetic field
In any event, it is clear that a sideways magnetic field, to the right, will create an upward force on the beam of electrons. So you would need an upward electric field (acting on electrons, remember) to exert an opposite and equal downward force on the electrons.
It's also relevant to mention that the magnetic field force is dependent on the velocity of the electrons, while the electric field force is not. So the condition of zero deflection for a beam of electrons will serve to sort the electrons by velocity.