"Align rotation with snapping target" not working properly
I believe the problem is that you are doing this in Edit Mode, all within a single object. Instead you should be doing this in Object Mode, and the cube should be a separate object from the surface you want to align it to.

With all the vertices of the cube selected, press P to separate it into its own mesh object. Then try again from Object Mode.