$\def\fitch#1#2{\quad\begin{array}{|l}#1\\\\\hline#2\end{array}}$
Yes, that is okay. You do not need to substitute every occurance of the replaced term. $$\fitch{[a, b]}{\fitch{~~1.~~a=b}{~~2.~~a=a\qquad{=}\mathsf {intro}\\\~~3.~~b=a\qquad{=}\textsf{elim }2,1\quad\because~\color{red}a=a,a\color{red}=b\vdash \color{red}b=a}\\\~~4.~~a=b\to b=a}$$