What keeps bitcoins mined in testnet from being used in mainnet?
Yes, that's correct. A mainnet node would just see those transactions as invalid because the outputs they attempt to spend are not in its database. It would have no idea that there is some other network on which they are valid.