help with custom rewrite rules

The part that modifies the blog post URLs/permalinks is in the mandoe_update_post_link() function (which is hooked on post_link), and the part that you need to adjust is this:

return home_url( '/blog/' . $post->post_name );

Just change the '/blog/' . $post->post_name to '/blog/' . $post->post_name . "https://wordpress.stackexchange.com/" and the URLs would end with a slash. However, you may need to clear your site (and browser) caches in order for your sitemap to be using the new URL format, or for you to see the changes applied.