I'm wondering if it's possible to create programmatically a Salesforce organization (DEV or Sandbox).
You can create a SandboxInfo to create a new sandbox. I do not think this works directly in Apex, but you should be able to make an API call against your org to initiate a creation or refresh.
Yes you can do that, You can use Salesforce SFDX command line client to create Scratch (Developer orgs),
And as its a command line you can program it as per your need.
You can go through the trailhead which will let you know the steps to do it.
If you are in hurry, you can just dig into the developer guide https://resources.docs.salesforce.com/210/latest/en-us/sfdc/pdf/sfdx_dev.pdf