I also have been having this problem since Nougat. My phone will never last past 15℅. It usually dies at 25℅ and at it's worst, it once died at 45℅. It's super inconsistent.
I'm feeling like I need to get a replacement device but am also wondering if this is somehow software related.