Well you would rotate the player, but only IF the downward trace was hitting a tagged actor/object. That way the system only attempts to rotate him to the angle of the surface he’s positioned above IF that surface is one designed for him to go around (eg loops). This will avoid issues with the player erratically rotating near corners or when walking over slightly irregular level geometry.
And as long as you always apply the “downward” force in the direction of CAPSULE down, the actor will always be pushed toward the surface beneath his feet. Since he’s rotating along with that curved surface, he should be constantly rotating slightly to match it as he moves forward, and therefore always pressing against it.
If he falls off the edge, the comparatively short downward trace no longer detects a “loop” surface, and switches back to normal gravity (whereupon you’d probably want to fire a Timeline that lerped his rotation back to normal or something).
But again, that’s specifically for loop running, i.e. a situation where you wouldn’t want the player to be able to jump and land at a sideways orientation. I’ve got wallrunning in my game that works really well without ever even rotating the player capsule, for example; my solution works well but as with the loop solution, is hardly a comprehensive wall-walking subsystem. I think you have to approach the problem by specific needs; wall-walking is only really necessary in games where the player can stand around on a wall, sideways, and should mostly be able to do all of his normal actions. If all you want is for the player to be able to run sideways across walls, or run around loops, or something, there are much simpler approaches.