I have got trouble imagining the outcome of gluing two solid tori $D^2 \times S^1 \sqcup_{\text{id}}S^1 \times D^2$ along the identity of $S^1 \times S^1$.
If I understand correctly, the tori are glued along their boundaries. How can one imagine that?
There are actually many ways of doing this, depending on how we identify the boundaries of the two solid tori. Any matrix in $SL_2(\mathbb{Z})$, defines a map $\mathbb{R}^2\to \mathbb{R}^2$, which is well defined modulo the lattice $\mathbb{Z}^2$. That is, it induces a map $S^1\times S^1\to S^1\times S^1$.
Note the lattice points in $\mathbb{Z}^2$ are naturally identified with $\pi_1(S^1\times S^1)$ (as $\mathbb{Z}^2$ consists of the translates of the base point $(0,0)$ under the action of the fundamental group). From your notation, it is natural to pick basis' $e_1,e_2$ for the fundamental group of the boundary of the first solid torus, and $f_1,f_2$ for the second, where $e_1$ and $f_2$ are each contractible in there respective solid tori.
It is easy to see that identifying boundaries via the map given by the matrix: $$\left(\begin{array}{cc}0&1\\1&0\end{array}\right)$$ results in $S^1\times S^2$.
The more interesting case is the identity matrix (which possibly is your original question): $$\left(\begin{array}{cc}1&0\\0&1\end{array}\right)$$
This gluing results in the three sphere $S^3$. There are two natural ways to visualize this.
$$S^3=\{(x,y,z,w)\in \mathbb{R}^4\vert x^2+y^2+z^2+w^2=1\}$$
This decomposes into two solid tori: $$\left\{(x,y,z,w)\in S^3\vert x^2+y^2\leq \frac12\right\},\qquad \text{and} \qquad\left\{(x,y,z,w)\in S^3\vert z^2+w^2\leq \frac12\right\}.$$
The other way is to identify: $$S^3=\partial(D^2\times D^2)= S^1\times D^2 \sqcup_{s^1\times S^1} D^2\times S^1.$$