I haven't had this happen for at least a year or so now, and it's quite likely this is linked to various major changes that have happened in my life since then.
But yes, I totally agree with you about your conclusion.
I tend to get them when I'm way too relaxed as that makes me "stretch out" during sleep, which I kinda notice in half-sleep as feeling great, until I seemingly "overstretch" and get fully woken up to a painful calf cramp.
Tho that whole problem kinda fixed itself once I started taking Magnesium supplements before going to bed, to help with teeth gnashing/neck pains.
I only take it when I feel a twinge in my calf. I figure I'm probably deficient in magnesium or something. Even if it is a placebo, it seems to work.
I might have an absorption issue though. Magnesium salt topical spray (less costly than pills) helps intantly unclench my neck/shoulders, and theres extant literature on that being an effective method of administration.
This was the same for me with RSI. It was simply the act of realizing it was psychosomatic and caused by stress that made it disappear completely.
A friend's wife died, and he got sick afterwards. Grief? Illness went away when he stopped eating badly (his wife had prepared most meals for him).
Of course, he had switched to a pretty bad diet, and he was older, more likely to be affected by diet.
Cramps, for example, can be often be prevented with potassium, which is in plants. Some people don't eat plants as much when they are stressed, leading to cramps.