How can you make SSH read the password from stdin, which it doesn't do by default?
You can't with most SSH clients. You can work around it with by using SSH API's, like Paramiko for Python. Be careful not to overrule all security policies.