Looking up 0x3001 I see that BLE_ERROR_NOT_ENABLED is defined as (NRF_ERROR_STK_BASE_NUM(0x3000)+0x001). So it would seem that you're calling sd_ble_evt_get() without having enabled the SoftDevice first.

Otherwise, the APP_ERROR_HANDLER(ret_code) at line 291 in nrf_sdh_ble_evts_poll() should only be called if be called if sd_ble_evt_get returns NRF_ERROR_INVALID_ADDR (0x10) or NRF_ERROR_DATA_SIZE(0x0C).

I think that better approach would be to use the sd_softdevice_disable and sd_softdevice_enable API. The nrf_sdh_disable_request will only disable the SD if all the observers acknowledge the request. I think that nrf_sdh_is_enabled() might evaluate to true while the SDH state is NRF_SDH_EVT_STATE_DISABLE_PREPARE so the while loop might be exited prematurely.