Hi, I am back with an explanation.
The problem lies in Android.
If you enable encryption, your PIN is used as a part of the encryption key.
However, if you grant the accessibility permission to some app, the app acquires the right to read your screen, including the PIN. Therefore the Android (cleverly) excludes your PIN from the encryption key, so that noone can get to it and abuse it to decode your information.
Your data keeps being encrypted, just the PIN is not a part of the key anymore.