Yeah but now you answered your own question. The deposits represent a claim to debt, they are what is used to settle the debt. So the bank can't just delete the deposits it creates. Debts would become unpayable electronically and then cash must be used to settle all transactions.
The obvious factor is liquidity between banking institutions and liquidity requirements by the central bank.
When withdrawing cash, the bank has to give you central bank money, not commercial bank issued money. If it doesn't have this CB money it has to borrow it from the central bank. So having central bank deposits saves you these costs. The other factor is that transfers between banks are also settled with CB money so you either borrow it from the central bank or get it from customers. Finally, the central bank wants to limit maximum money creation by mandating that a bank must keep a percentage of central bank money.
In short the bank could exclusively operate on money borrowed from the central bank but customer cash deposits are cheaper.
People don't withdraw cash. They transfer it to another bank. When they transfer it to another bank the destination bank becomes a depositor in the source bank.
That's how correspondence banking works.
Central banking is nothing more than an optimisation of that process. There is no need for central bank money to do bank transfers. The liquidity automatically arises.
When a bank makes a loan they already create a corresponding pair of asset and liability on their balance sheet.