I'm just like you, I like to mount/umount my filesystems from the command line.
About the stdin option
I'm not sure if it's reasonably safe. Is it worse than .netrc items?
You should be aware that on many systems, process names and command line arguments are visible to all users. In Linux for example, do grep -a . /proc/*/cmdline to see them all.
That said, in some shells including bash, echo is a built-in command so there's no process launched.
So, as far as I know, it should be no worse than .netrc. Double check your file permissions in any case.
SFTP
You can have gvfs-mount sftp://somehost/somepath work without a password. (I just tested this successfully.)
The recommended solution is to use key-based authentication, not store any password anywhere.
For example, see authentication - How can I set up password-less SSH login? - Ask Ubuntu and Easiest way to copy ssh keys to another machine? - Ask Ubuntu (it's written for Ubuntu but works the same for other Unices).
I know about ssh-copy-id, but I can't access shell on most of my sftp servers.
ssh-copy-id is just a handy shortcut. You don't need shell access to set key-based authentication, but you do need access to your home dir.
If you can access you files interactively with SFTP, you can most probably set up ~/.ssh/ and ~/.ssh/authorized_keys, unless the administrator carefully prevented this, but that would be shooting in their feet. Actually the admin should encourage users to set up key based authentication. Check what's the policy with them.
If you just need to set up only one key you just have to copy your public (not private) key file generated above (possibly ~/.ssh/id_rsa.pub) to a remote file in directory .ssh named authorized_keys and set permission 600 (read-write for you, nothing for others).
FTP
Regarding ftp urls, the traditional answer is to use a ~/.netrc as explained e.g. on https://askubuntu.com/a/359802/68124 .
Alas, it works very well with a zillion ftp clients, old and new, including curlftpfs, but (on Ubuntu 14.04 at least) gvfsmount ignores it.
Perhaps curlftpfs would suit your use case. The main difference is that you choose your mount point instead of having gvfs-mount compute one.
curlftpfs ftp://host/ ~/mymountpoint
SFTP, again
If you like the curlftpfs option, you may consider for your sftp urls,
sshfs host:/some/remote/path ~/myothermountpoint
And if wonder whether sshfs needs shell access, Wikipedia says: The client interacts with the remote file system via the SSH File Transfer Protocol (SFTP),[2]
A final word: for tools that need an explicit mount point, think to create an empty dir first at the correct path. And if you're trying several times or change options, remember to fusermount -u somepath to umount before trying to mount again.