Alex Marquez overcame a crash, scooter dash and last-minute tyre gamble to snatch a Q2 place at the end of a wet Friday practice for the Czech MotoGP.