In the Thunderbird folder pane, create an actions in the contextual menu to fold all subfolders at all sublevels under the selected folder. May be placed aside the "new subfolder" command, or in a new submenu.
First of all it's not clear where this contextual menu should be: right clicking the 3 dotts next to folder pane bar, we have no useful command.
But, above all, I think you misunderstood the question: in the past it was possible to collapse ALL folders of EVERY accounts by the key \ Then there was the famous plugin Keyconfig which now is no longer compatible to recent TBs.
For instance: I have 12 email accounts configured, each one with its subfolders. So we are talking of about 100-150 subfolders in all.
Obviously, there's the view which shows only the unread messages but if one needs to have the full view, we have to collapse each account one by one!
Double click collapses all sub folder of the folder double-clicked. So all that is left is for a root folder to be exposed in the folder pane so all accounts can be collapsed. How do you suggest that should be handled in the unified folder view?