this would work easily too, just change the collision response on the pawn rather than all the ledges.
so you create invisible walls, give them a custom collision channel. have the pawn block that channel and then as your game state needs change the collision to ignore.
if its overlapping on change can add some knockback to reset the pawn