Creating child nodes when creating parent
Your main problem here is you won't be able to create a reference to the created node in a form submit as the node id hasn't been created yet. I'm not actually sure at what point it becomes available in the node process either. hook_node_save is still too early and it's the last node specific hook you can do this with.

I would skip trying to do this programmatically and use rules and entity reference field. Have your rule fire after a new node is saved. then have it create a new entity (node) and set data value (entity_reference) to the newly created node. much easier to maintain than code.