@zorinlynx Maybe your brain caught the precursor signals for the cramp, and incorporated that into the dream.
I remember one time I was having trouble breathing while asleep, and my brain incorporated that into a dream by making me see my face turn purple in a mirror.