Say you have a weight tied to each side a a rope which is strung over a pulley with friction. Here's a really easy way to see why the tensions on each side of the rope can't be equal.
Imagine a really stiff pulley - in other words, ${\bf F}_\text{friction}$ is high. If that's the case, it'll be possible to balance unequal loads on this pulley system - i.e. a heavy weight on the right side and a lighter weight on th left - without the system moving. If the weights don't move, then we can say that the forces acting on each weight add up to zero:
For the heavy weight, there's the weight downward, ${\bf w}_\text{heavy}$ and there's the tension of the right side of the rope upward, ${\bf T}_\text{right}$. The tension pulls up and the weight down, and the system doesn't move, so
$$ {\bf T}_\text{right} - {\bf w}_\text{heavy} = 0
$$
or
$$ {\bf T}_\text{right} = {\bf w}_\text{heavy}
$$
Similarly for the left (light) side,
$$ {\bf T}_\text{left} - {\bf w}_\text{light} = 0 \quad \Rightarrow \quad{\bf T}_\text{left} = {\bf w}_\text{light}
$$
As you can see, the tension on the right, ${\bf T}_\text{right}$ is equal in magnitude to the heavy weight, while the tension on the left, ${\bf T}_\text{left}$ is equal to that of the lighter weight. The friction is introducing an extra force which changes the tensions on each side.
As far as your question about rope stretching goes, if you anchor a rope on one side and pull, the rope will pull back, creating a tension. This is indeed because of stretching in the rope. This is not really what Newton's 3rd law is referring to. Newton's third law, in this case, tells us that the force that we feel from the rope, tension, is exactly the force the rope feels from us pulling. The two are equal and opposite. You can change the tension by changing the stiffness of the rope, but whatever the tension, Newton's 3rd law will still be true - the rope will feel us pulling it as much as we feel it pulling us.
On the pulley on the left, there are 4 forces applied, $T_1'$, $T_2'$, the gravitational acceleration on the pulley (its weight) $m' g$ (directed downwards), and the tension of the rope at the center of the pulley $T$, which is the one that you draw, but directed upwards. Now, the tension $T$ balances the weight $mg$ and the other two tensions $T_1'$ and $T_2'$, and the pulley don't move.
However, the toques of the tensions $T_1'$ and $T_2'$ may not balance, and may result in a rotation of the pulley. In fact, if $L=I\omega$ is the angular momentum of the pulley, $I$ the momentum of inertia, and $\omega$ the angular velocity, one has
$$
\frac{d L}{dt}
=I\frac{d \omega}{dt}=r T_1'-r T_2'
$$
where $r$ is the radius of the pulley and the terms at the right side of the equations are the torques of the tension forces applied to the pulley.
If your problem is just to determine the static equilibrium of the system, and not its dynamics, you may want to assume $\frac{d L}{dt}=0$ and therefore balance the two torques $r T_1'=r T'_2$, that is, $T_1'=T_2'$.
Best Answer
I will only consider taut, inextensible ropes. This represents an approximation regime where tension is much less than the Young's modulus of the rope material times the cross-sectional area of the rope. (As we will see this condition is enough to guarantee the conclusion for straight segments of the rope as long as they are light compared to what ever they are attached to.)
Let's start with the easiest case: there is a frame of reference in which the entire rope is still.
In this case we can reason thus: the rope is subject to net zero external force (by Newton's 2nd Law). Further any internal element of the rope must be subject to equal and opposite forces from neighboring elements. Those forces are the tension in the rope so the tension is the same throughout.
[Note that the rope need not be massless.]
Next easiest case is the rope is in motion with constant speed along it's own length, but it may pass over circular pulleys with no friction at bearing (but with enough friction at the grove that the rope does not slip) and the like so any given part of the rope might change directions at times.
The argument in part (1) applies to segments between the pulleys.
The pulleys themselves have no angular acceleration and are therefore subject to zero net torque. So, the segments on either side of the pulley have the same tension because they have to exert equal and opposite torques.
[Note that the neither the rope nor the pulleys need to be massless.]
Now we come to cases where the rope is accelerating along it's own length.
If we assume a massless rope then any change of tension along the length would cause arbitrary acceleration. That's a nasty case because it s non-physical, but it represents an approximation of a regime where the mass of the rope is much smaller than the mass of anything it is connected to. Demonstration Atwood's machines are roughly like that.
A straight, massive rope (segment) accelerating along it's own length. The segment is subject to a net external force $F_n = F_1 - F_2$ where $F_1$ and $F_2$ are the net forces at either end, so that the acceleration is $a = F_n/m$. The rope segment is assumed to have uniform mass density $\lambda = m/l$. At any fraction $f$ along the length of the rope the tension must be such that the segment on each side of conceptual divide has the same acceleration (to prevent extension without allowing slackness). So tension $\tau$ (which is the same in each direction from Newton's 3rd Law) at position $fl$ must meet the requirements $$ a_1 = \frac{F_1 - \tau}{\lambda fl} \;,$$ and $$ a_2 = \frac{\tau - F_2}{\lambda (1-f)l} \;,$$ where $a_i$ is the acceleration of the segment closer to force $F_i$, and $a_1 = a_2$ is required. Thus \begin{align*} \frac{F_1 - \tau}{\lambda fl} &= \frac{\tau - F_2}{\lambda (1-f)l} \\ \frac{F_1 - \tau}{f} &= \frac{\tau - F_2}{1-f} \\ (1 - f)(F_1 - \tau) &= f(\tau - F_2) \\ -\tau &= (f - 1)F_1 - fF_2 \\ \tau &= F_1 - fF_n \;. \end{align*} Now, this depends on $f$, which means that it is not constant, right?
OK, but the term is $fF_n$, and $F_n = ma$ where $m$ is the mass of the rope segment. So, if the rope is much less massive than the things attached to it's ends, this terms could be negligible compared to $F1$ (or, indeed $F_2$ since the labeling is arbitrary). Then we get $$ \tau \approx F_1 \,,$$ which justifies the claim in item (3) that the hypothetical "massless" condition is an approximation for "very light".
Next we could let these things run over low friction pulleys. We can recover the 'tension the same throughout' conclusion only if the pulleys are also "very light" so that we can use an argument like that in item (2) because the torque on them will arise from force small compared to $F_1$ or $F_2$.
Once the pulleys have non-trivial mass and the rope is accelerating than the segments must be assumed to have different tensions even if the rope is light.