You can use nicematrix, but
- the space occupied by the overbraces is not taken into account;
- we need a trick to move the parenthesis a bit farther from the matrix.
In order to fix point 1, a phantom tall enough is added. For 2, some explicit spacing. I guess you wanted 12 and 6789, in order to single out the disjoint cycles, otherwise it would make little sense.
\documentclass{article}
\usepackage{amsmath}
\usepackage{nicematrix}
\begin{document}
Some text to see whether the vertical spacing is good. Some more
text in order to get more than one line. This should be enough.
[
\pi=\left(;\begin{NiceArray}{*{9}{c}}
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \
2 & 1 & 3 & 4 & 5 & 9 & 6 & 7 & 8
\CodeAfter
\OverBrace[shorten,yshift=1pt]{1-1}{2-2}{\sigma}
\OverBrace[shorten,yshift=1pt]{1-6}{2-9}{\tau}
\end{NiceArray};\right)
\smash[b]{\vphantom{%
\begin{matrix}0\0\0\0\end{matrix}
}}
]
Some text to see whether the vertical spacing is good. Some more
text in order to get more than one line.
\end{document}
