Is that a way to decrypt partition in TWRP?
Maybe some modified TWRP?
When official TWRP asks for pattern - it not works.
1. Use the factory firmware to do a factory reset, you need to erase data.
2. After you enter the stock rom, set PIN or other code.
3. Flash twrp.img via fastboot, you will get a temporary twrp recovery and you can decrypt data with your PIN or code, then flash the twrp.zip.
4. Then you can decrypt data all the time in twrp.
It works well on my Moto X4.