Why lab sessions are handled by TAs?
I think your question extends beyond programming-related courses and also applies to virtually any course with a significant hands-on laboratory component (think chemistry labs, biology labs, physics labs, etc).
The main reason that TAs or lab instructors are used in these subjects is because hands-on instruction does not scale as well as lecture-style instruction. A professor can easily lecture about an algorithm to hundreds of students at the same time. But can the professor also help hundreds of students implement and debug the algorithm on their computers? Not very efficiently.
This is why TAs and lab instructors are hired. They can provide more individualized guidance and instruction with hands-on learning than a single professor probably ever could, and they are much cheaper.