MAPK feedback encodes a switch and timer for tunable stress adaptation in yeast