Well; first. . . yeah, if you've got a barometer, and you're seeing storm clouds, time to get the heck outta dodge! It's not time for sheep. It's time for shepherds.

Second - any of us CAN be caught by surprise out in the backcountry by storm patterns.

What you did do is pretty much the good advice.

Find shelter, (cave, nooks under boulders, etc.) BUT STAY OUT OF DRAINAGE! (in case of flash flooding)

Stay away from tall rock pinnacles, isolated trees, but you could be safe in groups or clusters of shorter trees. (lightning is most likely to go after the tallest object, but that's not guaranteed!)

Lightning actually is a slow process, and begins with a charge buildup, and there can be warning signs several seconds before the discharge. Hair standing on end, tingly feeling, etc. Some people have said they remember seeing it coming out of the ground or nearby objects (and photographs show this) - but this happens so quickly, there's no time to react.

Discard obvious conductors: fishing poles, ice axes, trekking poles, external frame packs, tent poles. (fiberglass doesn't conduct that well, aluminum conducts EXCEEDINGLY well!).

Getting down on top of your pack (to insulate you from the ground) (if you've got an internal frame pack) - hands touching legs, so current channels through your limbs, not your trunk, on your knees, tucked into a ball.

You'd think that your rubber boots would insulate you right? I've seen pictures of people's boots or shoes blown apart by lightning strikes. If the current is jumping across 1000+ feet of air, it can probably make it through 1/2" of rubber.

I have also heard, as a protection against shock from thunder, to cup your hands over your ears, and open your mouth. (to allow the pressure wave to equalize - so your eardrums won't rupture). But this wasn't in any training class I've yawned through.

I've been caught outside in hail, and so was my son, with his scout troop, in New Mexico, a couple of years ago. Not fun. There was another scout troop that was hit by lighting out in the field in California a couple of years ago too.(I'd prefer the hail, thanks!). You read about people getting killed by lighting at Yosemite all the time.

Main thing is to recognize unsafe weather conditions when they're starting to build up, and get down off the mountain and to a safer location.