The derailleur is, unfortunately, one of those critical parts that is very hard to protect from damage; without sacrificing another part.
As Batman pointed out, you can purchase small hoops that attach to your frame and offer some protection. As he pointed out though, these types of products might protect the derailleur to some degree, but you risk transferring those damaging forces to the frame in a crash. Besides that, a derailleur is constantly moving and is very exposed to anything that might knock, touch or grab it.
There really isn't a whole lot you can do. It is easier said than done, but try not to fall as much. Pick your lines carefully through rocks and keep an eye out for anything that will snag it. If you lay your bike down on the ground, always make sure to lay it with the brakes facing the ground, in order to not put the weight of the bike on the derailleur.
One thing that I must ask, is if your derailleur has been damaged multiple times; during any of those incidents, did your derailleur hanger suffer damage? If the hanger has not ever been bent or snapped, maybe it is too stiff/strong and not taking any of damaging forces. I have always had bad luck with very soft hangers that snap prematurely. Try to find a lower quality one and use that. Maybe next time the hanger will bend instead of your derailleur.
Another thing that should be mentioned that every time you bend the derailleur back into its correct position, it gets a little weaker. It will bend under pressure that much easier each further time it is put under stress. Parts get fatigued and sometimes must be replaced, even if they still appear to be semi-functioning.
Sometimes it just comes down to luck at the time of an incident. Sometimes you take a spill and come out of it with zero broken parts. Other times, you can be looking at major damage to something (even from the most innocent of crashes).