WP custom routing does not work

You have to flush rewrite rules after new rules are added. Visiting the permalinks settings page flushes the rules, which is why it worked after you did this.