I fixed it by luck. I used Xiaomi Tool V2 to flash the MIUI 12, then used the tool to flash back to LineAge OS 19.1. All fixed. I will now stay with LineAge 19.1 to stay out of trouble.
It seems I have figured it out!
So to recreate Persist image partition with orginial data:
I have manged to create persist.img by this - run these commands from TWRP terminal:
PART 1 - backup:
You can "wipe" persist with the command:
dd if=/dev/zero of=/dev/block/bootdevice/by-name/persist
And back it up with:
dd if=/dev/block/bootdevice/by-name/persist of=/sdcard/persist.img
The file is exactly 32MB in size. You should backup persist.img file from the tablet.
PART 2 - recovery:
dd if=/sdcard/persist.img of=/dev/block/bootdevice/by-name/persist
reboot back to TWRP go to - advanced - file manager - try to find this path - or adjust according to yours: /dev/block/platform/soc/c0c4000.sdhci
Then create a partition /persist using mke4fs command (x shoud be replaced according to yours path - see above):
mke4fs -t ext4 /dev/block/platform/xxx/xxxxxxx.sdhci/by-name/persist
Failed to mount message appeared, but after restart it was OK and new Persist image partition with size 32MB was crated (you can check in Backup option in TWRP)
All sensors work, rotation works. Accidental sreen lock still persists - I assume that the sensors need to be calibrated (or I do not know for now).
Let me know if it worked for anyone else (I am not sure if the last two commands (dd and mke4fs from part 2 - recovery) shoud be in different order - i have experimented so much...)