Submitted a raw tx that was already on the blockchain, to test it. I got 'missing inputs' instead of 'already exists'. Why? In an attempt to more fully understand raw transactions etc, I went to look at tx 518c41d5e59114f6a23383afbe95f02cdd09cb50cabd8390bdd9162a890435b3 in its raw form being:


  01000000017871f56f7be2743293abb1adccf21526265e4ad793fddbc08508417293fd6b4e000000006a47304402201f3b98d55c16a1ff9e66cbdd5533fd74d18362477f50dbce357d66e1233ba469022066fd837cf7e1e030f5aab0f22fec06c7d98ee948fd8b9aba185512426079e0a201210284ca3e364bebb4cafb9fa76624927078e16a4244314f824ea8acff0ef1ba4627ffffffff0220a10700000000001976a91488d924f51033b74a895863a5fb57fd545529df7d88ac81f1d909000000001976a914db4c1f7949870fae5cdc366a45e2ea39c084547c88ac00000000


I then tried to submit that raw form, just copy and paste into my bitcoin wallet program to "sendrawtransaction" and got the error missing inputs (code -25).  This seems odd in it of itself because since this is an exact copy and paste of the raw transaction that is on the blockchain, shouldn't it not be missing anything at all?  Also, shouldn't I be getting a "transaction already exists" error instead?  Or do I not understand something about how raw transactions are submitted?
Bitcoin Core has no idea which transactions already exist in the chain. It does not maintain a full index, because... it doesn't need to. In fact, when running in pruning mode, it doesn't even have the chain or its transactions at all.

The only thing it has is the set of unspent transaction outputs. Since you're trying to replay an existing transaction, all the inputs are already spent by its previous instance. As a result, the expected and correct response is that inputs are missing - i.e. your transaction is a double spend, and thus invalid.

I'd say that this is one of the advantages of the UTXO model: a replay and a double spend are one and the same, and there is no need to distinguish.