It's pretty simple. This is a bug. It's not even that consistent, being able to actually gain height is luck-based. For any minute application where climbing walls in this manner is actually useful, it can be made 100 times better with a mod such as the parkour player or the zombies from zapt