Just out of curiosity, then how does wallets like blockchain.com manage millions of wallet? They may be receiving walletnotify callback every second.
I got your point and we also thought of the same, to run loop for every wallet on our node to check for gettransaction.
You run two databases, one which is storing all tx for all transactions, one which is holding all public keys for your wallets. for each mined block you update databse #1, compare with number 2, then send notify. You can do this in python.
/KX