There is a known problem (GM has a TSB - Technical Service Bulletin detailing it) with symptoms that sound very familiar to what you're describing. I experienced it a few times and it is indeed scary. The problem is caused by a connector under the steering column that can intermittently make contact and supplies info from the StabiliTRAC yaw sensor. When the yaw sensor data is wrong, the car thinks it's rotating and applies the brakes to one side of the car to counteract.
You can have any GM dealership reference the TSB and apply the repair. I might have posted about this about 12 years ago, so the forum's search function may be of help. Start with XLR + StabiliTRAC and the TSB number may show up. I'll check my records but can't promise any additional info.
CC