Because what he did wasn’t illegal. It was just wrong. They didn’t want anything to do with him any more, but he didn’t break the law and so they couldn’t use that part of the contract to terminate it.
They felt it was so wrong that they paid him $20mil to break that contract. They absolutely would have taken another option if it was viable.
There are things that you shouldn’t do or say to minors that aren’t illegal, but anyone reading them would still know it’s it’s unethical/wrong/immoral/whatever. They clearly thought he crossed that line, enough that they’d rather fire him and take a chance on losing the court case for damages for breaking the contract. And then they lost that court case.
It clearly wasn’t just “a chat with a minor”. The rumors I’ve heard is that he was attempting to make plans to meet up with them at a convention. That would definitely be in the “big no no” category for a celebrity talking to a minor, even if nothing untoward was suggested in that conversation.