The best way to restore your Mac to factory settings is to erase your hard drive and reinstall macOS.
That link goes to "How to erase your Intel-based Mac" ~ with detailed specific steps to try & perform.
• How to 'Show All Drive Devices' in Disk Utility for MacOS
https://osxdaily.com/2019/08/16/show-all-devices-disk-utility-mac/
..Invisible in newer systems, the selection to "Show All devices"
is essential to erase All; to leave nothing behind. ~ Then, that is
no longer the cause of the problem you keep finding. The Disk
Utility, when used to Erase the Disk, goes after the entire content
of that physical drive. Not simply some partitions. They all go..
..In Disk Utility on your Mac, you can change the view to show all devices or only volumes in the sidebar..
• View all devices or only volumes in Disk Utility on Mac - Apple Support
https://support.apple.com/guide/disk-utility/view-devices-volumes-disk-utility-mac-dskud6b39edb/mac
[Mojave uses an APFS partition format scheme; & rules differ, compared to older GUID HFS+ partitions.]
You can add/remove systems, and parts, within Volumes; while not necessarily erasing Disks. Confusion.
• The Difference Between a Drive, Disk, Volume, Partition, and Image - make tech easier
https://www.maketecheasier.com/difference-between-disk-drive-volume-partition-image/
• Add, delete, or erase APFS volumes in Disk Utility on Mac - Apple Support
https://support.apple.com/guide/disk-utility/add-erase-or-delete-apfs-volumes-dskua9e6a110/mac
Be sure you attend to specific details and figure what they mean. If you 'Erase a Disk', that usually means
the entire physical drive. While anything less, means you're only erasing a 'Volume' ~ a portion of a drive.
"Disk -or- Volume" = also appears different in Disk Utility.
{..Contents of this say less, yet assumes you know the level of strength in details of those words used..}
• Erase a volume using Disk Utility on Mac - Apple Support
https://support.apple.com/guide/disk-utility/erase-a-volume-dskutl14079/18.0/mac/10.14
• Disk Utility User Guide -'Table of Contents'- Apple Support
Maybe this could be useful. Or maybe not! I'm happier being a few systems behind
and have more than one Mac; mile posts of those times, as 'in situ' reference, here.
Good luck & happy computing!
🌞🌿⛵️🌤🎣🤖🏕🐝⛄️🌻