It could be a variety of issues. Heat expands things and creates further distances. It also creates higher electrical resistance. The heat could be causing a defective crank sensor to act up. It could cause the distributor points to get to far from the spinning rotor. Best bet is to take it to a professional mechanic in your area with good reviews for a diagnosis.
I’m getting the same issue with a friends iPhone 7 Plus. I’ve tried a battery from another reputable source and an now an Ifixit battery and both are doing the same thing. Phone doesn’t reboot with original battery, only these replacements.