If you pipe the output to
tee, the standard output file descriptor is no longer a TTY device. POSIX TTY (or pseudo-terminal) semantics differ from those of a pipe. For low-level details (if you find those interesting), please refer to the following manual pages:
$ man 4 tty
$ man pts
That said, the most straightforward way to attain the desired behavior is via Tcl
expect. This program allows you to automate input/output to an external program. The package is available in most GNU/Linux distributions, e.g., to install it on Ubuntu:
$ sudo apt-get install expect
For your particular use case, I would do the following (assuming that
root executable can be reached via
spawn root -l
root  // type your code here; <Tab>, etc. can be used normally.
root  .q
All the output will be logged to
root_output.log -actually, it will include TTY control sequences, e.g., color changes. Therefore, the best way to visualize this is via
$ less -R root_output.log.