That's certainly possible. You will usually see an AVR board such as Uno/Mega controlling the ESP8266 used only as a WiFi module running the AT firmware but it's certainly possible to do this in reverse. You will probably not find any code already written for you as you will in abundance for doing it the other way but it's quite simple. You would need to decide on the method of communication between the two. Usually you will see them communicating via Serial.
You could also use an analog multiplexer IC specifically designed for this purpose instead of another Arduino..
DFRobot Wifi Bee-ESP8266 is a Serial-to-WIFI module using XBEE design in a compact size, compatible with XBEE slot, applicable to a variety of 3.3V single-chip system. It can be used for Arduino, wireless data transfer, remote control. On-board switch can be used to easily select the Startup module or Upgrade firmware.
ESP8266 arduino module has a powerful on-chip processing and storage capacity, built-in 32-bit processor, built-in Lwip protocol stack. Support AP+STA mode co-exist. And you could configure various parameters via AT commands. ESP8266 Wifi Bee (Arduino Compatible) - DFRobot