Two different Containers after factory reset? Macintosh HD & Macintosh HD Data?
For a Mac with a single internal drive, starting from scratch usually means erasing all partitions from the drive and creating a new GUID Partition Map with a hidden FAT32 formatted EFI partition and either a legacy Mac OS Extended (Journaled) formatted partition or a APFS container partition containing a single APFS formatted volume. The erase operation is usually performed by using the Disk Utility, but also can be performed by using the diskutil command.

Apparently, you either did not perform an any erase or erased a volume instead of the drive.

Once the drive is erased, a macOS can be installed. If required, any selected Mac OS Extended (Journaled) formatted partition will be automatically converted to APFS.
To show the drives in the Disk Utility window, select View&gt;Show All Devices from the Disk Utility menu bar or press the key combination ⌘+2. Also from High Sierra, Mojave and  Catalina, you can select Show All Devices from the pulldown menu shown below.

For Big Sur, the pulldown menu appears as shown below.

When erasing, you should get a popup asking for name, format and scheme. Below is an example from Big Sur. For scheme, you should always choose GUID Partition Map.