When a theme or plugin adds or changes a custom post type, a taxonomy, a rewrite rule or an endpoint, WordPress keeps serving its old, cached rewrite rules. The new URLs return 404 until someone goes to Settings Permalinks and clicks Save.
Permapilot does that for you. On every request it compares a lightweight fingerprint of the registered routes with the one the rules were built from. When they differ, it rebuilds the rules once. When nothing changed, it costs one option read and one hash.
It catches:
add_rewrite_rule().add_rewrite_endpoint().There are no settings. Activate it and forget it.