I have found a better way to accomplish this all in a single call by utilizing REST API.
You use the endpoint automation/v1/automations to create (POST) your new automation.
See below example:
Authorization: Bearer XXXXXXX
and then the ...
Database.convertLead is going to create a new contact, unless you modify the LeadConvert object to use an existing contact Id.
See here https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_dml_convertLead.htm
Sets the ID of the contact into which the lead will be merged (this contact must be associated with ...
Your code won't work in bulk (try using the Apex Data Loader to insert two or more opportunities on two or more accounts at once). In addition, you have a lot of redundant code by implementing a naive trigger handler class, and you have a lot of waste in your queries by not using an aggregate query call.
All that aside, the answer to your original question ...