Retrieve storage numeric id earlier when still available

The numeric id is only available before the storage entry is deleted, so
get it at that time.

Fixes https://github.com/owncloud/core/issues/11545

Please review @icewind1991 @MorrisJobke @LukasReschke