Agreed that that approach isn't as scalable. Have you explored Microsoft Graph data connect? For extracting emails (or other supported data sets) at scale that would be a recommended starting point. If that doesn't meet your needs we'd love to hear your feedback.
Overview of Microsoft Graph data connect - Get access to data at scale
https://learn.microsoft.com/en-us/graph/data-connect-concept-overview#get-access-to-data-at-scale
Get started with Microsoft Graph data connect
https://learn.microsoft.com/en-us/graph/data-connect-get-started?view=graph-rest-1.0