What prevents a miner from stealing inputs when they are still in the working pool ?
Bitcoin uses public key cryptography, so each address has an associated public key, and private key.

A transaction is signed using the private key of the inputs, without knowing the private key, you cannot move coins. So if someone (a miner) wants to change the outputs of your transaction to steal coins, their modified transaction would be rejected due to invalid signatures. 

For their attack to be successful, they would need to know your private key, so that they could use it to properly sign a transaction to output addresses that they control.