So, in the end, Uta has no feelings for the teacher and is only having sex with him to keep both her friendship (though she wants more) with Touko in tact and to keep Touko with the teacher since he has more feelings for Uta. She's sacrificing her own feelings to act as a bridge so to speak because without her acting as a bridge (both intentionally and unintentionally from what started it all) then all the relationships fall apart.
@Hawk86 Sensei admitted that he loves Touka now too when he was apologizing, it's not really as complicated as you're making it. Without Uta they would just continue by themselves, Uta is just taking advantage of the situation since she can't be straightforward in her desires