Cross is a sport of many mysteries. How is Joey okay? How can I be a minute behind if the race only started 30 seconds ago? Why did my rear derailleur just fly off? The first two of these are best left to greater minds than mine, but I have an answer for the third: probably because your jockey wheels got fouled.
Your chain feeds into the rear derailleur from the bottom, so the bottom jockey wheel is the "first" part of the drivetrain that the chain touches. Then it goes through the top jockey wheel, around the cassette, and then onto the chain ring. The chain ring is the "last" thing the chain touches.
As you shift gears, the derailleur not only moves inboard and outboard along the cassette, it pivots around the pivot bolt (circled in yellow), which is also how your derailleur is attached to the derailleur hanger. The pivot arc is roughly described by the curved blue arrow. When everything is operating smoothly and the chain is moving through the jockey wheels freely, the movement of the chain and the pivoting of the derailleur are related, but not intimately involved with each other. The "pull" from the top of the chain only causes the jockey wheels to spin, it doesn't cause the derailleur to pivot.
When the jockey wheels get clogged with mud, grass, crap (literally, sometimes), or whatever, they don't spin as freely. Any resistance to their spinning causes the derailleur to want to pivot upwards along that blue arc. In minor cases, this might feel like a "ghost shift" when you hit the pedals with the impressive kind of wattage that I throw down. If a jockey wheel gets fully jammed and can't spin at all, the force of the chain's pull will have nowhere to go except to cause the derailleur to pivot. Fast. Congratulations, you are now infected with Catastrophic sudden Rear derAilleur Pivot syndrome. Symptoms include the sudden cessation of your bike's ability to move forward, your rear derailleur hanger shearing off, and your general inability to stop moving forward.
So how to prevent this dreaded disease? First, always use a condom. I don't necessarily know that that has anything to do with CRAP, but every time I've watched Jerry Springer and someone says "first, I always use a condom" it gets huge applause, so I figure it's got to be a good thing. Second, start the race with CLEAN jockey wheels. Brush them, spray them, remove them if you must (it's easy, but keep them separate since they are bottom and top specific - the bottom one is supposed to have some side to side play to accommodate varying chain entry angles), and then lube them with a good dry lube. I spray them with Elmer's "Dry Slide" which is a super dry, very slippery aerosol lube that's also the only thing that reliably treats Speedplay cleat squeak. If the wheels themselves are nicked or worn, replace them. They're cheap and readily available. You don't even need to take off your chain to do it. While you are riding, be aware of how your chain feels. Maybe look down after you go through a nasty patch, and definitely back pedal once in a while as this can dislodge some of the crap that pedaling sucked in.
Catastrophic sudden Rear derAilleur Pivot syndrome has ended many a race. Don't let it happen to you.