Safest way to slow down a bike quickly if both sets of brakes fail
BMXers in some places put the shoe between rear tire and frame, just where the rear brake normally is attached to the bike. I've never done that, because I used to run knobby tires (ouch!), and nowadays I care a lot about brakes.

You really should avoid this situation, because many times there would not be much to do.

I would guess, a good alternative would be to turn sharply while leaning the bike, and then skidding the rear tire sideways. That is already difficult to do in a planned way, what to say when you are frightened...

A good thing to do is follow the advice "brake early, brake often", so you don't have to find out your brakes are not working only when is already too late.