It's basically as you worked out, if you keep the sails cleated in, there's a chance that you go over.
If you have a leaky boat that makes it worse as all of the water in the hull goes to that corner adding to the weight in the corner.
Uncleat the mainsheet early since when you pass through the wind. Having the mainsheet cleated in tightly will not only possibly backwind and flip you as happened but will also turn you back into the wind making the turn that much harder as well. Also in strong winds, have the crew go across earlier to keep weight on that side. Get in the habit of uncleating the mainsheet before you start the turn, or better still, in heavy winds don't cleat the mainsheet at all.