I may give more details on the rng later. At the moment there is still too much money lying around.
Does anyone know how to check if there is an unconfirmed transaction trying to spend an output?
Do I have to use bitcoin-cli listtransactions and then dump each transaction to check which output was spent?
The wallet operations on bitcoind are so slow when you have 1400 private keys imported.
I hate that signtransaction or sendtransaction don't tell me which input it is that I shouldn't spend

.
Can you rephrase your questions and tell me what you intend to do and then how you do it right now?
Let's skip the part about how you get the information about endangered coins, but I assume you have a list of endangered outputs and you are looking for a handy way to check, if they are already spent. Is that correct?
You may use:
$ bitcoin-cli help gettxout
gettxout "txid" n ( includemempool )
Returns details about an unspent transaction output.
Arguments:
1. "txid" (string, required) The transaction id
2. n (numeric, required) vout value
3. includemempool (boolean, optional) Whether to included the mem pool
It returns
something, if an output is
unspent and nothing or empty otherwise. It can only be used to test, if an output is unspent, but not, if an output is spent. Out of range values, invalid transaction hashes, ... are accepted input and result in "nothing" as well. As per default unconfirmed transactions are checked.
Checking an unspent output on mainnet:
$ bitcoin-cli gettxout ee0e927dc8a0523ca7892e36fb0dbc0dac3b75bdc17903150676fdc604da6628 2
{
"bestblock": "00000000000000001060e25a1d458ab361863d9f3d5c95481c6caadd40190abc",
"confirmations": 42629,
...
}
$
Checking a spent output on mainnet:
$ bitcoin-cli gettxout ee0e927dc8a0523ca7892e36fb0dbc0dac3b75bdc17903150676fdc604da6628 3
$
This transaction is few thousand blocks deep, but it should also work for in-mempool transactions.
How do you sweep coins? What do you need to be more efficient? Do you have, besides a list of endangered transactions as I assume, also the associated private keys? Would it help to have a script to autosweep coins based on a list of transactions and private keys?