Ssh and scp (6.2p2 or 7.4p1) can't support the way to input the private key password in a non-interactive manner. As a result, the program automatically executes ssh/scp, which is difficult to use. Generally, the private key of the null password can only be used, which poses a security risk. At the same time, private key encryption is an optional method. If you use errors, there is also a security risk. It is recommended that the software support automatic encryption of private keys, which is safe by default.
Generally your best option in this case it to use ssh-agent. It is possible to ssh-add passworded keys to an agent by passing the password on stdin. In OpenSSH 8.4, it will also be possible to force the use of $SSH_ASKPASS via the $SSH_ASKPASS_REQUIRE environment (see bug #69), which might offer another approach for you.
Mass close of all bugs fixed in 8.4 release.