Adding an automatic permalink flush just before clearing the caches (after updates) to fix known issues with Wordpress' permalinks breaking when a plugin update changes or adds new rewrite rules. This is essentially a replacement for going to WP's settings > permalinks, and clicking save to fix URLs which should resolve but fail to do so. In a recent example, updating Rank Math, which handles the sitemaps, broke the URL to the sitemap_index.xml, likely because they updated the way they rewrite it with WP. Resaving the permalinks fixed the 404 on the sitemap index and the URL properly resolved again as a 200. This should be a simple addition of WP's flush_rewrite_rules() function between the update (theme or plugin) and before the cache flush (and could be dependent on user selecting to flush the cache or not). It would ensure the server's URL map is correct before a fresh, static cache is generated after updates.