How does the wallet know which outputs are available with LevelDB
The wallet is to a large extent separate from the rest of the node software. One of the reasons for this is because of the (slow) progress towards a working SPV mode. This means the wallet cannot depend on access to the UTXO set, as it won't be available in non-validating nodes.

However, it isn't needed. The wallet maintains an index of all input prevouts inside the wallet. Every output that is seen in a block, is to a wallet address, and which is not in this index as the input for another wallet transaction, is spendable.