get_the_category_list() returns a formatted list of category names, which does not (as you discovered) include the IDs.
get_the_category(), by contrast, returns an array of WP Term objects. A WP Term object looks like this:
["term_id"]=> //int
["name"]=> //string
["slug"]=> //string
["term_group"]=> //int
["term_taxonomy_id"]=> //int
["taxonomy"]=> //string
["description"]=> //string
["parent"]=> //int
["count"]=> // int
["filter"]= //string
["meta"]= array(0) {} //array
Source: https://developer.wordpress.org/reference/classes/wp_term/
As you can see, you can very easily pull out both the ID and the parent ID if present.
Once you have the parent ID, you can fetch its name with get_cat_name( $cat_id );