You don’t need to pay off all your loans in order to get everything owed to from your employer, or to be able to leave the UAE after your employment visa is cancelled. And you can keep your bank accounts open after you leave (probably ok until your UAE ID expires).
However if your account balance doesn’t clear your debt your card will be frozen until your debt is cleared. You can continue to make payments from home country and come and go from the UAE freely, provided you keep up your payments.
On your LDS your final salary transfer minus retention (around 4K AED) gets transferred into “guaranteed” account (I believe this payment also notified your bank with loan you’re leaving). Same day you can collect EOSB Cheques from EOS. B fund funds for me got transferred 2 months later into same account along with rentention funds (I selected wrong option on EOS portal, I assume/believe you can get all provident fund on your last day as a Cheque to be cashed wherever however you wish).
The notion you cannot leave UAE with debt is a myth to keep you there.