Electric field in a wire?

The electric field in a wire is parallel to the wire's surface (it is always pointing "to the front"). If the electric field did not point in this direction, surface charges would build up and change the electric field to make it point the correct way.

In the above diagram the electric field vectors are pointing the wrong direction, but there will be no charge build up, since the current flowing into the junction is same as the current flowing out. So in this scenario how would the surface charges rearrange to make the electric field point in the correct direction?

The electric field assigns a single vector quantity to each point in space (specifically, the direction in which a positive test charge would accelerate if it popped into existence at that point, assuming it didn't perturb the setup creating the field in the first place). I believe that the difficulty of this question arises from an ambiguity in the problem statement: to which point(s) do the two vectors you have drawn assign electric fields?

They cannot both correspond to the single point $$P_{lr}$$ at which the drawings of the left and right arrows intersect (the head of one touching the tail of the other) because this would imply that a test charge dropped at $$P_{lr}$$ would accelerate simultaneously in two different directions! You could adopt the convention of summing the accelerations a la Newton II, since two forces $$F_1$$,$$F_2$$ that would have caused accelerations $$A_1$$,$$A_2$$ if applied separately actually cause acceleration $$A_1+A_2$$ if applied simultaneously. But this would force you to admit, by the definition of the electric field, that $$E(P_{lr})=E_l+E_r$$ which points along the wire and does not violate the rule that the drawing was intended to be a counterexample of.

We could adopt a different convention for deciding which points the arrows assign electric fields to (perhaps taking the point to be the tail or the tip of each arrow). But this arrangement does not imply anything about current building up or not building up in either place.

Let me propose a slightly more formal version of your question: what prohibits the inside of a wire from sustaining a solenoidal (circulatory) vector field? Solenoidal vector fields don't converge or diverge (lead to charge buildup) anywhere, but they are not necessarily equal to zero. An example would be the velocity field of a 2D whirlpool.

The answer: nothing! You can generate one of these fields by accelerating a magnet through a pipe. The electrons are dragged around the pipe in circles, which produces a magnetic field opposing the field of the falling magnet. If you use an everyday conductive material like copper, a constant acceleration force like gravity will inevitably "win", since resistance takes away some of the electrons' ability to build a perfectly opposing magnetic field. As they rotate around the pipe in circles, their potential decreases to 0, which means that there must have been a circulatory electric field in the wire.

However, if you use a superconducting material, circulatory currents are able to perfectly oppose impinging magnetic fields, leading to the Meissner effect (superconducting levitation). If you made a superconducting wire and placed a magnet nearby, the wire would have all sorts of circulatory currents on the inside that did not point along the length of the wire, but these wouldn't necessarily be due to electric fields since superconductors don't require electric fields to sustain currents.

Another possible way of obtaining circulatory fields in the wire would be a high-frequency alternating current (google "skin effect" if you're interested), although the elementary description of the physics is a bit more complicated in that case.

I would hazard a guess that the context of this question implicitly forbade arrangements consisting of moving magnets and alternating currents. Mathematically, the condition of "no changing magnetic fields" implies that there are no circulatory electric fields. By the Helmholtz decomposition (vector fields can be written as a sum of an irrotational and a solenoidal field), the earlier argument that the current (and therefore E-field, in a non-superconductor) must be divergence-free suffices to prove that the field is constant, and the fact that it must have no component normal to the wire surface then suffices to prove that the field must be constant AND point along the direction of the wire.

I don't know what mathematical background you have, so if the talk about Helmholtz decompositions didn't ring a bell then you'll have to wait for vector calculus.

Summary: the confusion was due either to a misunderstanding of the definition of "vector field" or due to implicit assumptions (no changing magnetic fields, no changing electric fields) in the problem statement. Hope this helped :)