Growing up in the 80s meant that pretty much any kids movie was going to be traumatizing. Gremlins: horrifying. Neverending Story: emotional damage. The Land Before Time: can't think of dinosaurs without tearing up. It's like the whole movie industry was explicitly devoted to fucking us up.
I vividly remember watching that movie in the theater. My brother and I were so hyped we were standing on our seats for the opening song. Then they had Optimus Prime cuss and we absolutely couldn't believe it. When he died, I had never seen such bullshit. Optimus Prime can't die, he was the toughest robot ever.
I suspect a bunch of animators wanted their work to be taken seriously as art, but were stuck making kids movies, so they made kids movies that were shockingly dark to try to persuade people that animation was a versatile medium.