I read that the Confederates formed square at Gettysburg, probably the only square formed during the entire ACW, when the Union cavalry bluffed a charge.
By this time the only cavalry that could be counted on to carry a charge home was elite European cavalry.
It's probably a combination of factors including cavalry training, doctrine, the cavalry's self-image, and to some extent the lethality of the weapons, although I have my doubts on that last one even though it's the accepted explanation.
Hook