Tracking links that have been added via tokens
@Andrei - thanks a lot for pointing me to the solution!

Based on your answer, I wrote this function that did the trick for me for finding and converting links in arbitrary $html: 

function trackUrls($html, $contactId, $jobId){

    // Find all URLs
    preg_match_all('#\bhttps?://[^\s()&lt;&gt;]+(?:\([\w\d]+\)|([^[:punct:]\s]|/))#', $html, $matches);

    // We need to find the mailingId and the eventQueueId
    $mailingJob = civicrm_api3('MailingJob', 'getsingle', ['id' =&gt; $jobId]);
    $mailingEventQueue = civicrm_api3('MailingEventQueue', 'getsingle', [ 'job_id' =&gt; $jobId, 'contact_id' =&gt; $contactId]);

    foreach($matches[0] as $url){
        $replacements[$url] = CRM_Mailing_BAO_TrackableURL::getTrackerURL($url, $mailingJob['mailing_id'], $mailingEventQueue['id']);
    }

    $html = str_replace(array_keys($replacements), $replacements, $html);

    return $html;
}