An update. After much messing around, the solution we've come up with is to leave both interfaces up and to use lwip netif_set_default() to set the default interface based on priority. If you are using standard C sockets, you could alternatively bind() the outgoing socket to a particular IP (again based on interface priority order).
Actually I do the control of the Wi-Fi and GSM interfaces following these steps:
1. I start up the WiFi interface with the default configs in STA mode
2. I start up the PPPOS interface (ppposInit), then it connects to the GSM network
3. I start up a WiFi scan in order to discover if my Wi-Fi network is available
4. If it is available, I disconnect the GSM (ppposDisconnect) and connect to my WiFi passing the SSID, password (esp_wifi_connect)
5. If I lose the WiFi connection (event SYSTEM_EVENT_STA_DISCONNECTED), I go back to the GSM connection (ppposInit) again.
How do I put both interfaces up in the same time and set which one is the default for (netif)?