For starters, I will say that your use case is highly unusual. Nobody really designed their blogging system to publish 5000 posts or pages in a single day.
Second, I think your Python import script is probably not going to work because of this security system:
At the same time, 5,000 hits is not 50,000 hits, so it might be that the hits limit is not the thing to worry about.
Still, I would opt for a WordPress plugin to do it. A quick Google search tells me that there are various plugins that can do bulk importing of posts and pages, such as this one: WP Import – Ultimate CSV XML Importer for WordPress – WordPress plugin | WordPress.org
Note that most import plugins assume your content is in a CSV file. But if you were able to code an importer script yourself, then turning your custom chapter file format into a spreadsheet shouldn’t be a problem.
If you insist on doing something that can import your custom format, I would still go for the plugin route, but consider creating a custom plugin. That’s also the best way to get access to WordPress directly from within WordPress itself, without having to use the REST API.