Suppose we have the following document

```
#+title: test-file

* This is h1

** This is h1.2

We introduce some text here

Then we narrow to this heading and introduce a footnote


* Another heading here so that footnote capture works
#+begin_src
(org-element-property :buffer (org-element-at-point))
#+end_src

* Footnotes
```

When we narrow to h1.2 (subtree) so that * Footnotes is not visible - after adding the footnote, when we check

(org-element-property :buffer (org-element-at-point)) at any headline level or anywhere
It returns nil - inplace of the #<buffer> element it should return

This causes functions to fail that rely on this.

I am on Org mode version 9.8-pre (release_9.7.11-145-g28b631 -- the version we get when we clone the git today (2024-10-03)

Thank you, let me know if you need any information in reproducing it.