Removing all my hardcoded URLs with get_site_url()

You actually already were pretty close:

function autoblank($text) {
    $return = str_replace('href="https://wordpress.stackexchange.com/questions/138730/,"target="_blank" href=", $text);
    $return = str_replace(
        "target="_blank" href="' . get_site_url(), 
        'href="' . get_site_url(), 
        $return
    );
    $return = str_replace('target="_blank" href="#"https://wordpress.stackexchange.com/questions/138730/,"href="#', $return);
    return $return;
}
add_filter('the_content"https://wordpress.stackexchange.com/questions/138730/,"autoblank');
add_filter('comment_text"https://wordpress.stackexchange.com/questions/138730/,"autoblank');

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)