Auto Page Creation

I'm working on a multisite setup which requires auto page generation on creation of new sites. I have a script I used for single site installs which works on single wp but when I run it on mu the pages it creates are a bit weird.

I believe it might be associated with the issue of the page author being assigned to the admin who setup the site instead of the site's admin user.

Page this script creates exist but when i try to edit through dashboard it says the page doesn't exist.

I have pasted the code I'm using here -

Initially I was calling the author as well but removed that part of the code as I am not familiar with how to assign the pages to the new site's author.

If anyone could advise that would really be appreciated.