MacTeX is installed as a Homebrew cask, casks can't be pinned though (see https://github.com/Homebrew/homebrew-cask/issues/49127#issuecomment-401501245 and https://github.com/Homebrew/homebrew-cask/issues/90242)
A huge chunk of casks auto-update and we can’t stop that. So pin would at best be inconsistent and not work in a lot of cases.
There is a user-written extension called homebrew-cask-upgrade which seems to address this issue, but I have no experience with it and it may bring along other issues.
For your specific scenario, I would just install MacTeX directly from TUG and avoid any auto-updating triggered by Homebrew. Or, if you don't need the GUI applications bundled with MacTeX, use brew install texlive
which just installs the non-GUI binaries and can be pinned.