Note: This is a partial answer(merely a workaround).
Some users have posted about the bug (saying this bug is present from long time)
in reddit and oneplus forums.
Since it is a bug, there is no definitive solution to this.
One possible work around is to simply turn off the screen by pressing lock/power button
and turn back on by pressing lock/power button again again, and enter your pattern.