Mechanistic model of MAPK signaling reveals how allostery and rewiring contribute to drug resistance