It looks like only folders that are the iCloud Drive can be added to the dock. I have some folders in OneDrive that I am unable to add to the dock, which is a pity, as I use OneDrive more than iCloud Drive.
This was usually only available for iCloud Drive, but 3rd parties can now opt in into that as well. If that is the case, it should also work with Dropbox folders and OneDrive/Google Drive shouldn't work.
(Note, that Dropbox for iOS has a "Native Files.app integration" setting that allows to switch between a "classic" and a "new" integration.)