Is there an RUU for your variant? If so, I'd try that. RUU is a complete software image. So if its a software issue, RUU will hopefully fix it. Factory reset would only make a difference if some setting or 3rd party app caused the issue; since all factory reset does is wipe user data (/data partition).
Rooting in itself won't solve the issue. It hard to say whether this is hardware or software related, so therefore also hard to tell if a different ROM or other mod will help. I'd be hesitant to recommend rooting to try to fix an issue which is quite obviously a manufacturing defect of some sort (whether it be software or hardware). You would be possibly voiding the warranty for something that is most likely a warranty issue.
If you factory reset, and RUU (if that is available) and the issue persists, I'd seek warranty service. In that case, it might be a hardware issue.
Please click the "Thanks" button if you found a post helpful!
Phone: AT&T HTC One (M8)
Tablet: Samsung Galaxy Tab Pro 8.4 (WiFi only)