What Causes This?

This Rheem water heater shows signs of scorching around the electric access panel. Where the screw holds that panel on is chared/burnt. The water temperature is 157°F.
Obviously this has been deferred to a licensed Plumbing and/or Electrical contractor. But, what would be some common causes of this scenario?

Fried control or arcing parts.

Why?

Because the water was too hot? It’s not obvious to me…

Oh, I see it now.

The element terminal is melted and the thermostat has a broken case.

But it still makes hot water!

The TPR discharge needs to be corrected as well…

Why? It is plumbed to the exterior.

It is going up hill.
Looks like rust to me ,not scorching which brings up images of gas flame.