If calling out a troll is toxic, why not ban the troller and not those on the receiving end? Seems like you would have fewer bans and a happier player base.
First of all; Riot has to determine whether or not the player in question is actually a troll. The playerbase in general is notoriously unreliable at determining actual, legitimate trolling or intentionally feeding, and what some players will readily brand a troll is typically actually someone who's underperforming.
Secondly; in order for Riot to even investigate whether or not the player in question was trolling, you'd need to report them. 90% of the time, people "call out trolls" (I.E, flame players) first before thinking of reporting, since you can only report after a match. Simply banning trolls (regardless of how valid the ban is) wouldn't change that order of operations much.
Third; Riot does ban trolls. You can act like they prioritize Chat punishments over trolling/intentional feeding all you want, but at the end of the day, trolls do get punished; they're just difficult to accurately detect, partially due to how many ways one can troll and partially due to the community crying "wolf" over pugs.
Fourth; At some point, you need to recognize that you yourself are part of the problem. Y'know the Internet adage of "Don't feed the troll"? Well, "calling out a troll" is feeding the troll. If the player is in fact a troll, you're just validating their behavior and giving them more reason to troll. Rather than put the impetus on Riot to "just ban the trolls", you should recognize that you are a contributor to the problem too, and that if you think that someone is trolling, do not talk to, of, or about them. Don't even give them the time of day. Report them post-game, and don't fall for their shenanigans.
I don't understand my ban when I see homophobic and racist chat every other game. I have a game where I engage a troll and get a chat ban?
You don't have to be homophobic or racist to get a punishment; in point of fact, homophobia and racism demand escalated punishments, but there's still a whole breadth of other misbehavior that Riot doesn't allow in their game. And, no. Just because other people break the rules frequently (ignoring the likelihood that they get punished for it) does not give you liberty to break the rules yourself.
Is there something I missed in the chat logs that caused me to get banned?
It's probable. If you want a peer review, you can submit your chat logs here and the community would be glad to weigh in on your behavior. Most people typically break the rules without even realizing it (such as with defeatism or passive-aggressive remarks), and it's not entirely uncommon for some people to be so inured to other misbehavior that they regard it as perfectly normal.
Or do the bans not take context into account...
The IFS does not take context into account. It does not matter why you flame or misbehave, if you break the rules, you get punished. You alone are responsible for your own actions.