Thank you, Steve.
Prior to the update, the $link would return the actual link to the subcategory. After the update, it returned nothing.
I removed the get_category_link and replaced it with get_term_link($term_id, ‘product_cat’); since I’m searching for subcategories in WooCommerce. This is now working as expected.
Apparently get_category_link doesn’t work for this anymore, and get_term_link doesn’t work either in 4.9 without the second parameter.