I see two good use cases: Dividers between (folded) headings should be still visible and not swallowed by the folding and a divider at the bottom with metadata should not be included in the folding.
A:
## Folded heading...
---
## Another folded heading...
B:
## Some heading
- Some bullets
---
Meta: data
Additionally, the line could be indented to move the folding "stop" to another, deeper heading. But this is hard to discover and might not be compatible with other apps.