They (about) were, AFAIK, but using them with computers wasn’t their first usage.
https://en.wikipedia.org/wiki/Teleprinter:
“A teleprinter (teletypewriter, teletype or TTY) is an electromechanical device used to send and receive typed messages through various communications channels
[…]
Initially, from 1887 at the earliest, teleprinters were used in telegraphy. Electrical telegraphy had been developed decades earlier in the late 1830s and 1840s, then using simpler Morse key equipment and telegraph operators
[…]
With the development of early computers in the 1950s, teleprinters were adapted to allow typed data to be sent to a computer”
Even for that, there was prior art. https://en.wikipedia.org/wiki/Printing_telegraph, which used a piano-style keyboard.
The Linotype also is quite old. https://en.wikipedia.org/wiki/Linotype_machine:
“The Linotype machine operator types text on a 90-character keyboard.
[…]
In July, 1886, the first commercially used Linotype was installed in the printing office of the New York Tribune.”
Pianos however don't really have a concept of advancing the line or sending a recorded message.
I have never really thought about it but a player piano sort of implies it can only play the roll. If pressed I would guess that player piano rolls were cut by hand. I mean, I am sure they had tools to help them and probably fully automatic duplication machines. but did anyone play the piano to get a piano roll? or was it more like transcribing sheet music?