Lock settings are stored in /data/system/locksetting.db and other files with filenames locksettings. Now since /data/ is encrypted, you cannot access it without decrypting. And, even if you decrypt phone by entering correct pattern, and then you delete those files, that would make the entire /data useless and forever encrypted because there would be no way to decrypt it anymore.
On my HTC 10, I have custom ROM installed and /data isn't encrypted by default, unlike OnePlus 9. You have to manually encrypt from Settings > Security if you want. So, if I don't have encryption, I can go to TWRP and simply delete /data/system/locksettings.db and phone lock would just go away. However, if encryption is enabled, and I go to TWRP, decrypt with correct lock code, then delete the same files, it would not work. The phone will boot up and would be stuck after bootanimation. I would have to format data and only then it would work again.
Ain't no way you can bypass encryption. You either enter the correct lock code, or just get super lucky and try again again through brute forcing.