Yes, as you said is for economic security.
See also this answer by Gav in a previous StackExhange Question: Is there a limit to the size of a map in Pallet storage?
The deposit scheme helps ensure that (even after 10 years) the state is storing a manageable amount of data and only that which is the most economically valuable. Polkadot employs this technique ubiquitously.
As an example of how the deposit is helpful for security I like to see the Recovery pallet. The Recovery pallet is an M-of-N social recovery tool for users to gain access to their accounts if the private key or other authentication mechanism is lost.
It has two deposits:
FriendDepositFactor : The amount of currency needed to reserve for creating a recovery configuration.
RecoveryDeposit: The base amount of currency needed to reserve for starting a recovery.
The first one is the typical example as you mention for incentivise unused storage cleanup and the second is primarily held for deterring malicious recovery attempts, and should have a value large enough that a bad actor would choose not to place this deposit. He will lose it if he is discovered during the attack.