I started looking at this code in order to squash a bug: when moving to the maze side above or below the current one, there's a sudden shift because the view's up vector changes. When the camera followed the player precisely, it didn't matter, because the camera was aligned with the side's axial plane bisecting the view left and right* when the player was moving up or down to the neighboring side; but now that the camera accelerates, it's rarely aligned well enough for the shift to be unnoticeable.
The only real solution, of course, is to update the up vector every frame and have it be a true up vector, rather than update it when the player moves to the side above or below, and have it pointing in whichever axial direction is "up" based on the current camera orientation. But I got sidetracked looking at the horrendous code and didn't do it.
And I won't.
Not tonight, anyway. Partly because I'm still considering how best to approach it (even though I know myself well enough to know that I won't be able to think through it all until I'm halfway through implementing the change), and partly because I'm going to bed as soon as I post this.
I shall likely tackle the problem tomorrow. But for now: Good night.
*I hesitate to say Y-Z plane because the maze can be at any arbitrary rotation. Rather, it would be the axial plane most closely aligned with the camera's Y-Z plane