While on a ride, realised rear disc rotor was contaminated, what could I have done?
Oil and contaminants from the road will float to the top of these puddles and get on the rotors.

Unfortunately once rotors are contaminated, it is EXTREMELY difficult to decontaminate them due to the porous nature of the steel they use for the discs. When you throw fresh pads on, the rotor can contaminate the pads again.

As far as brake pad decontamination, there is hope. What we do here is


Heat the pad up with a blow-torch to expand the pad material
Spray a degreaser on the pad until it stops evaporating instantly
Sand the pad with 120 grit sandpaper until you see new pad material
Clean the pad off by hitting it with the blow-torch or isoprop-alcohol
Reinstall


As far as what could be done on the side of the road, you can try tightening the barrel adjuster for your brake until you can get some form of grip or wiping the contaminants off with the inside of your jersey (That's about it).

If you suddenly lose braking power to both wheels, you can try what BMX riders do and stick the heel of your shoe between the top of your rear tire and your frame.