That's really a problem with the 4x4, 5x5, etc.
The 2x4 can be oriented either way without issue. I have three of them. Two are the "wrong" way and one is right side up. In ten years of use, fully laden, I've not had a single problem.
All those internet photos of collapsed Ikea shelf disasters are the large 4x4 and 5x5 that are oriented on the sides, rather than right side up. Basically, the long internal shelf supports need to be the horizontal ones, and the short ones vertical, to support them, so that the wooden pegs that secure them aren't bearing any load. For the 2x4 it doesn't matter as much, since there is only one level of them with pegs bearing loads.

