I wrote a "cd" replacement for cmd[1] a _long_ time ago (I only recently uploaded it to Github).
It uses exactly this technique to run a thread in cmd's process to actually change the directory. It's kept working from XP on up to Windows 11 now. I am always amazed it works, I fully expect it to go boom some day, probably with an error along the lines of "Don't do that, please".
[1] https://github.com/seligman/ccd/blob/master/RemoteThread.cpp...