This should be difference between SharePoint Online Modern Page and SharePoint Online classic page.
In SharePoint Online Modern Page/Site, it will use ARIA <div role="heading" aria-level="1">
In SharePoint Online classic Page/Site, it will use normal Semantic Element <h1> <h2> as headings.
In Summary, this is by design in SharePoint Online due to the difference of Modern Site.