Arduino IDE 2.x does have a "Fold All Block Comments" feature, which can be executed either via the editor.foldAllBlockComments keyboard shortcut (Ctrl+K Ctrl+/ by default) or via the command palette (Ctrl+Shift+P).
Unfortunately, the approach used to determine the code structure for folding is currently fairly naïve, as explained already by Willem43:
The code structure determination is based on the assumption that it will always follow indentation. But, even when the code is perfectly formatted (which is something Arduino users are not so careful about), there are common instances where this is not a safe assumption.
One of those instances is block comments. Even though some do choose to indent block comment text, others don't and I don't see people getting fussed about either choice since we have more significant code style things to quarrel over, such as where to put those braces. By default, IDE 2.x does not indent the contents of block comments, so probably the majority of Arduino sketches written will not have them indented. The block comments without indentation are not recognized as code blocks by the IDE, and thus are not foldable.
I submitted a formal report about that here:
https://github.com/arduino/arduino-ide/issues/568
I notice that VS Code uses the same indentation-based code folding, and so has the same behavior as Arduino IDE 2.x:
https://code.visualstudio.com/docs/editor/codebasics#_folding
Folding regions are by default evaluated based on the indentation of lines. A folding region starts when a line has a smaller indent than one or more following lines, and ends when there is a line with the same or smaller indent.
However, VS Code also supports language aware folding based on information provided by a language server:
With the "C/C++ for Visual Studio Code" VS Code extension installed, the folding is handled correctly regardless of its indentation. Arduino IDE 2.x uses the Arduino Language Server, so it may be that the language server can analyze the sketch and provide this information to base the folding on.