Lets say Wach gets the upset and beats Povetkin. Wach would become Wilders mandatory challenger. Who wins?
In that case Duhaupas would beat Wilder too and we'd have Duhaupas vs Wach. What a great fight that would be.
To answer the OP's question, I'm 99 percent sure that the mandatory status doesn't transfer if a fighter loses a tuneup while he's the mandatory. They would probably either (a) make Wilder fight the highest-ranked available contender as the mandatory or (b) order a new elimination and Wilder would have to fight the winner within 180 days or something.