flashing rom – Failed to encrypt even after restoring system backup

The steps I took:

  1. TWRP flashed with Odin
  2. Made of backup
  3. LineageOS 14.1 flashed with TWRP
  4. SuperSU flashed with TWRP
  5. Open GApps flashed with TWRP
  6. There was a problem, Google Play Services was still crashing, I decided to restore the ROM stock
  7. Restored the backup I made in 2 with TWRP
  8. Opened my restored system and decided to encrypt the device
  9. Either the encryption failed itself or I disturbed it
  10. After restarting, unsuccessful encryption continues to appear
  11. I've restored the backup of 2 again, I still get an unsuccessful encryption
  12. I flashed LineageOS again – I started well
  13. Once again, I restored the backup of 2 again, I still get an unsuccessful encryption

In the meantime I wiped it Hidden, Dalvik Cache, The data and System several times.

So it seems that the ROM in stock continues to see information about the cryptographic process failing, even though I erased the 4 partitions mentioned above. An interesting part is that LineageOS plug in.

Any ideas on how to put the ROM back in stock?