Is there a method to know the temperature value of a microcontroller?
The vast majority of microcontrollers on the market today have some kind of built-in die temperature sensor. Often this is implemented as an extra channel on the ADC multiplexer. It may not be especially accurate, but should be fine for detecting an overheat condition.