Yes, it's a bug, I still don't know how to fix it
Have you seen if the collision box is the same size?
Because it's likely that when the sprite is changed, the collision box will be a little bigger.
The bug has been fixed; I simply made the walls push the player if they detect that they are inside the walls.