Just to add to the discussion, in SXA they only use getRenderingDatasource to create the Page data folder and adding the global and page data items to the DatasourceRoots object.
SXA creates the datasource item automatically in the Add rendering command. You can find the code in the assembly Sitecore.XA.Foundation.Editing in the function Sitecore.XA.Foundation.Editing.Commands.AddRendering.
The line where they actually create the item, after several if statements is
Item item4 = getRenderingDatasourceArgs.Prototype.InheritsFrom(TemplateIDs.BranchTemplate) ? Context.Workflow.AddItem(text2, getRenderingDatasourceArgs.Prototype, item3) : Context.Workflow.AddItem(text2, getRenderingDatasourceArgs.Prototype, item3);
then the event to assign it to the datasource and handle the page event.
string fullPath = item4.Paths.FullPath;
string arg = fullPath.StartsWith(getRenderingDatasourceArgs.ContextItemPath) ? ("local:" + fullPath.Substring(getRenderingDatasourceArgs.ContextItemPath.Length)) : item4.ID.ToString();
this.HandleResponse("'chrome:placeholder:controladded'", string.Format("{{ id: '{0}', openProperties: {1}, dataSource: '{2}' }}", itemNotNull.ID.ToShortID(), flag7.ToString().ToLowerInvariant(), arg), flag);
The command config is here.
<command name="webedit:addrendering" type="Sitecore.XA.Foundation.Editing.Commands.AddRendering, Sitecore.XA.Foundation.Editing" patch:source="Sitecore.XA.Foundation.Editing.config"/>