fundrawtransaction, send, and walletcreatefundedpsbt accept an input_weights parameter that sets the weight for transaction inputs. SetInputWeight uses map::operator[] which silently creates entries in the coin control selection set for outpoints not in the transaction, causing unintended UTXOs to be spent.
Validate that each input_weights entry corresponds to an actual input in the transaction before setting the weight.