On a multisite environment, get the subdomain value as variable

wp_insert_site recieves WP_Site object, which contains details about the current site.
https://developer.wordpress.org/reference/hooks/wp_insert_site/

do_action( ‘wp_insert_site’, WP_Site $new_site ) Fires once a site has
been inserted into the database.

https://developer.wordpress.org/reference/classes/wp_site/

WP_Site Object (
    [blog_id] => 2
    [domain] => localhost
    [path] => /m2/sagres/
    [site_id] => 1
    [registered] => 2018-03-23 13:49:37
    [last_updated] => 2019-03-05 15:52:10
    [public] => 0
    [archived] => 0
    [mature] => 0
    [spam] => 0
    [deleted] => 0
    [lang_id] => 0 
)

So to summarize you can change your function definetion to accept argument.

function create_cloudflare_dns_record(WP_Site $new_site) {

And use $new_site->domain and $new_site->path to get details about the site inserted