I have managed to restore the phone to full functionality, but lost the data in the process.

I had 6.0 installed and tried to restore it to the kdz file 20A. It failed to boot and got stuck again on the "Optimizing apps". Then I've found a download of the 20B version somewhere in the internet and installed it this morning with LGUP.

It took a bit of time to boot, but at the end it worked.

Don't know if it's worth mentioning, but I pulled the battery out for the night. Don't know if it had an effect over the process or not.