Engulfing a radio pulsar: the case of PSR J1023+0038