Sure, it works if you have treemacs open, and then change buffers. However, just try this exact steps:
open a fresh instance of emacs.
switch projects
open some file (ideally in some subdirectory)
now open a treemacs with SPC o p
now, look at the position of cursor inside treemacs window. It’s at the root of the project, and not at your previously open buffer. At least that how it works for me in the most recent version of doom.