The rope is considered massless and inextensible and so the tension will be the same throughout the rope except when some other external force acts on the rope eg friction.
A rope with such properties has the following functions:
1 transmit a force from one position to another
2 change the direction of the transmitted force.
With the pulley not being massless and there being friction between the rope and the pulley, remembering that the function of the rope is to transmit forces, the labelled forces in your diagram can be defined as follows.
Force $\vec T_2$ can be thought of as the force on mass $m_2$ due to the pulley and
force $\vec T’_2$ can be thought of as the force on the pulley due to mass $m_2$.
So in a sense they are a Newton third law pair being equal in magnitude and opposite in direction.
The same is true of forces $\vec T_1$ and $\vec T'_1$
If the pulley has mass and hence a moment of inertia and there is friction between the rope and the pulley then to accelerate the pulley a torque must be applied and this is provided by forces $\vec T'_2$ and $\vec T'_1$.
If the pulley is massless and therefore has zero moment of inertia then there can be no torque applied on it otherwise it would suffer an infinite angular acceleration.
So in this case the magnitudes of forces $\vec T'_2$ and $\vec T'_1$ would be equal and there directions are opposite.
To include the rope in a more formal way you would need to consider the force on the top of the rope due to the pulley and its Newton third law pair the force on the pulley due to the top of rope.
Also you would need to consider the force on the bottom of the rope due to the mass and its Newton third law pair the force on the mass due to the bottom of rope.
In this case the magnitude of the force on the top of the rope due to the pulley would equal the magnitude of the force on the bottom of the rope due to the mass and these forces would be in opposite directions ensuring a net zero force on the massless rope.
This would introduce extra (unnecessary?) forces to deal with.