Do you notice any bulging on the bottom of the laptop? It could be a bad battery. Take it into the nearest Apple Genius Bar for a free diagnostic check.
Where did you see that an out-dated MacOS was the cause.
Before going into the Genius Bar try the following:
1 - remove the battery and run on the power cable. See if the problem persists or not. If not then it's probably the battery.
2 - boot into Safe Mode according to How to use safe mode on your Mac and test to see if the problem persists. Reboot normally and test again.
NOTE 1: Safe Mode boot can take up to 3 - 5 minutes as it's doing the following;
• Verifies your startup disk and attempts to repair directory issues, if needed
• Loads only required kernel extensions (prevents 3rd party kernel/extensions from loading)
• Prevents Startup Items and Login Items from opening automatically
• Disables user-installed fonts
• Deletes font caches, kernel cache, and other system cache files
NOTE 2: if you have a wireless keyboard with rechargeable batteries connect it with its charging cable before booting into Safe Mode. This makes it act as a wired keyboard as will insure a successful boot into Safe Mode.
3- boot into the Recovery volume (boot with the Command + R keys held down - Intel Macs) or (How to Boot an M1 Mac into Recovery Mode), select Disk Utility and repair all available items, starting at the top.
If you get an error indication rerun till no error is detected.