I don't think that the reasons you've mentioned are really comparable.
Sex ed class is illegal, no doubt. It's felony.
Too many passangers in one car is illegal. It's misdemeanor.
Foul in basketball is illegal. It's breaking rules of the game (by the way, there is nothing about groping in basketball rules

. At least in their versions I know).
So the real issue is probably not the legal/illegal but what makes sense (at least some sense, contrary to nonsense) for Sophia and for the story. Sex ed class is not only seriously illegal but it's also stupid. Sitting in a car on somebody's lap... allowing for excessive contact in a game... this is completely different category, and I don't have any problem with this, especially if it's necessary for the plot. Let's hate or ignore any character from the game - because they are inconsistent, badly written, behaving in a nonsense way, but not because of a single unimportant incident.
No offence, just talking like cat to cat

.