I haven't checked your code, but...
When preparing the snippet from the original very old context i'd realized that it was not yet WideString-ready, and i'd adjusted that lately on the fly, so it might not to be final. Also it actually needs the $mode delphi, i recognized.
I'll check your advice surely.
Nevertheless basically it works (see attached POC), i'd mainly intended to point out the sort order issue (with this API, not Lazarus of course).
Beneath the sort order there's another inconsistency to the main app. Without going to deep yet i had not been able to tell
the SHBrowseForFolder dialog to use the metadarkstyle's dark theme, so the look-amd-feel differs; not severe, but not nice either.
So i'm thinking about to replace the SHBrowseForFolder dialog by an own one based on the ShellTreeView, which is less bound to OS-specifics btw.
The attached POC has 3 buttons:
#1. using TSelectDirectoryDialog (imo too many capavilities for some specific purpose; elaborated "new gui")
#2. using SHBrowseForFolder dialog (minimalistic as desired; "old gui")
#3. A FoiderSelector POC based on ShellTreeView instead of #2 (using it's new custom sort capability fortunately offered by wp).
A remaining ToDo in the dialog #3 is that the dialog's icon here unwantedly reappears when hovering the STV.
(The hack shown here
https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/19321does not work).
EDIT: solved when having set the dialog's BorderIcons := []