Yes, but the missing headings are within the narrowed subtree.

Am Mi., 11. Jan. 2023 um 12:22 Uhr schrieb Ihor Radchenko <yantar92@posteo.net>:
Michael Dauer <mick.dauer@gmail.com> writes:

> But within (org-with-wide-buffer) the collapsed branches should be visible.

You have `org-narrow-to-subtree' inside `org-with-wide-buffer':
1. `org-with-wide-buffer' widens the buffer
2. `org-narrow-to-subtree' narrows it to subtree
3. `org-element-parse-buffer' gets executed on the narrowed buffer

--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>