No It's not Ok.
having a high temperature on hardware (CPU/GPU) got noting to do with kernel it self it's about the task intensity of the program. compiling a code is a high cpu intensive task.
my recommendation is to basically get a better cpu cooler or better thermal paste how ever if you already have above mid-range cooling system make sure you screwd cooler tightly to the mother board and applied enough thermal paste. lastly make sure the case it self has good & correct airflow. you can always increase fan speed but it's noisy.
if you already did all of this i highly recommend to undervoltunder-volt the cpu from bios.
yes you can also under-clock cores by reducing clock speed if you want to extremely reduce temps but you lose performance.
yes your motherboard will reduce cores clock based on cpu thermal throttle settings in bios but remember you loose performance. i recommend to keep hardware temps below 85°C on max performance if you are planning for long term use.