[Moto G Q&A, Help & Troubleshooting] _3psilon_:
Thanks!

It erased everything OK, at least no error messages.

Fun fact: it still boots into factory recovery after erasing the recovery partition!

Fun fact 2: I still can't flash custom recoveries like TWRP. ('Partition mismatch' error and then boots into factory recovery as if nothing changed. If I manually 'mfastboot boot twrp....img' into the image, then the internal storage shows up intact as before the phone was broken!

Then I flashed new stock ROMs, all returned OK, but still bootloop:

mfastboot flash partition gpt.bin
mfastboot flash motoboot motoboot.img
mfastboot flash logo logo.bin
mfastboot flash boot boot.img
mfastboot flash recovery recovery.img
mfastboot flash system system.img_sparsechunk.0
mfastboot flash system system.img_sparsechunk.1
mfastboot flash system system.img_sparsechunk.2
mfastboot flash system system.img_sparsechunk.3
mfastboot flash modem NON-HLOS.bin
mfastboot erase modemst1
mfastboot erase modemst2
mfastboot flash fsg fsg.mbn
mfastboot erase cache
mfastboot erase userdata
mfastboot reboot

Here's the complete output:

D:\tmp>mfastboot erase system
erasing 'system'...
(bootloader) Erase allowed in unlocked state
OKAY [ 0.023s]
finished. total time: 0.025s

D:\tmp>mfastboot erase cache
erasing 'cache'...
OKAY [ 0.017s]
finished. total time: 0.018s

D:\tmp>mfastboot erase userdata
erasing 'userdata'...
OKAY [ 0.026s]
finished. total time: 0.028s

D:\tmp>mfastboot erase recovery
erasing 'recovery'...
(bootloader) Erase allowed in unlocked state
OKAY [ 0.037s]
finished. total time: 0.037s

D:\tmp>mfastboot erase modemst1
erasing 'modemst1'...
OKAY [ 0.012s]
finished. total time: 0.013s

D:\tmp>mfastboot erase modemst2
erasing 'modemst2'...
OKAY [ 0.012s]
finished. total time: 0.013s

D:\tmp>mfastboot flash partition gpt.bin
target max-sparse-size: 256MB
sending 'partition' (32 KB)...
OKAY [ 0.025s]
writing 'partition'...
(bootloader) This may take a few seconds, if a
(bootloader) different partition table is being
(bootloader) flashed since we need to backup
(bootloader) and restore a few partitions
(bootloader) Flashing primary GPT image...
(bootloader) Flashing backup GPT image...
OKAY [ 0.303s]
finished. total time: 0.330s

D:\tmp>mfastboot flash motoboot motoboot.img
target max-sparse-size: 256MB
sending 'motoboot' (1953 KB)...
OKAY [ 0.084s]
writing 'motoboot'...
(bootloader) flashing tz ...
(bootloader) flashing rpm ...
(bootloader) flashing sdi ...
(bootloader) flashing aboot ...
(bootloader) flashing sbl1 ...
OKAY [ 0.930s]
finished. total time: 1.018s

D:\tmp>mfastboot flash logo logo.bin
target max-sparse-size: 256MB
sending 'logo' (295 KB)...
OKAY [ 0.055s]
writing 'logo'...
OKAY [ 0.036s]
finished. total time: 0.095s

D:\tmp>mfastboot flash boot boot.img
target max-sparse-size: 256MB
sending 'boot' (10240 KB)...
OKAY [ 0.360s]
writing 'boot'...
OKAY [ 0.585s]
finished. total time: 0.948s

D:\tmp>mfastboot flash recovery recovery.img
target max-sparse-size: 256MB
sending 'recovery' (10240 KB)...
OKAY [ 0.363s]
writing 'recovery'...
OKAY [ 0.591s]
finished. total time: 0.958s

D:\tmp>mfastboot flash system system.img_sparsechunk.0
target max-sparse-size: 256MB
sending 'system' (257755 KB)...
OKAY [ 8.153s]
writing 'system'...
OKAY [ 7.753s]
finished. total time: 15.907s

D:\tmp>mfastboot flash system system.img_sparsechunk.1
target max-sparse-size: 256MB
sending 'system' (256953 KB)...
OKAY [ 8.132s]
writing 'system'...
OKAY [ 7.910s]
finished. total time: 16.044s

D:\tmp>mfastboot flash system system.img_sparsechunk.2
target max-sparse-size: 256MB
sending 'system' (260396 KB)...
OKAY [ 8.234s]
writing 'system'...
OKAY [ 7.899s]
finished. total time: 16.137s

D:\tmp>mfastboot flash system system.img_sparsechunk.3
target max-sparse-size: 256MB
sending 'system' (166176 KB)...
OKAY [ 5.274s]
writing 'system'...
OKAY [ 6.251s]
finished. total time: 11.528s

D:\tmp>mfastboot flash modem NON-HLOS.bin
target max-sparse-size: 256MB
sending 'modem' (49376 KB)...
OKAY [ 1.599s]
writing 'modem'...
OKAY [ 0.763s]
finished. total time: 2.365s

D:\tmp>mfastboot flash fsg fsg.mbn
target max-sparse-size: 256MB
sending 'fsg' (103 KB)...
OKAY [ 0.088s]
writing 'fsg'...
OKAY [ 3.177s]
finished. total time: 3.268s

D:\tmp>mfastboot erase cache
erasing 'cache'...
OKAY [ 0.015s]
finished. total time: 0.017s

D:\tmp>mfastboot erase userdata
erasing 'userdata'...
OKAY [ 0.019s]
finished. total time: 0.024s

D:\tmp>mfastboot reboot
rebooting...

finished. total time: 0.002s

D:\tmp>

I think I have the same symptoms as this user.

Maybe the file system is corrupted? Or the bootloader?

Or just the flash memory in the phone stopped working properly.

Let's recap:

Erasing partitions doesn't actually erase them but it returns OK

Can't erase userdata

Can't install custom recoveries

Flashing stock ROM returns OK but still can't boot.