Hi. What a request. This is new haha. I think it might be reaaaaally tricky but not imposible. If your reports/datasets size are lower than 1gb, then you can use the Power Bi Rest API for downloading.
I think using Power Bi and Sharepoint API you could create the steps with a script.
1- Export pbix file from Service to local machine or keep it in memory with API
2- Upload it to sharepoint with API
3- Get it from sharepoint and import at service (this is the only step I'm not sure that will result in the same way as browsing sharepoint from the UI)
4- If the duplicate is create delete dataset with API
5- Update datasources of dataset (complex step)
6- I guess you have deleted this one on step 4
If step 3 can't be done you can split the script in two. That should help a while.
I hope that helps,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Happy to help!