How would I go about making something like this?

I want to create something like this, ignore everything in the video apart from the movement of the player: https://www.youtube.com/watch?v=8fR0eI2hnS8&ab_channel=hisanimations

I like how the player can only move forward, not left or right. The issue is I have my character able to move normally, then I want them to climb into somewhere to be able to do this. Would it be easiest for them to possess another character than can only move forward?

Just temporarily disable the left and right movement:

Thank you!