Check if empty region failed
In theming the use of render() is correct, you can't use a different render method. The problem is that many blocks are placeholdered and you can't determine at the point the page template is rendered in which context the placeholdered block might be rendered in future. Probably then with a different user logged in because blocks cached per user are placeholdered by default.
The code in your question thinks the region is empty because striptags removes placeholders which usually are formatted as HTML tag.
You can change this at the expense of cache performance by adjusting the cacheablity of the blocks involved or customizing the auto-placerholder condition site-wide.
See https://www.drupal.org/docs/8/api/render-api/auto-placeholdering