Transform align to floor wonky behavior?

Godot Version


void Mob::align_to_normal(Vector3 normal, float delta) {
	Transform3D& new_transform = get_global_transform();
	new_transform.basis[1] = normal; // basis[1] = basis.y
	new_transform.basis[0] = -(new_transform.basis[2].cross(normal)); // basis[0] = basis.x basis[2] = basis.z
	new_transform.basis = new_transform.basis.orthonormalized();

This code is supposed to make the character align to the surface normal, but the way it acts is totally unexpected. When using this exact method in GDScript, it seems to work fine, but when I write this code here something seems totally wrong and I just don’t get it.
I’m really bad at transforms and 3D math. I’ve checked multiple times that the given surface normal is correct and it is.

It could be due to how you rotate the player when the user provides input. It seems to be aligning the transform correctly, but the children of the player node (collision and mesh) are being rotated locally?