To Reproduce...
- Create a Milestone (e.g., "Sprint 1") on a Project
- Add A Task (e.g., "Do X") to that Milestone
- Edit the tags on that Task, adding the top-level Project tag
You'll end up with a Task that has the tag $Project ($milestone) but is not actually on the "milestone" sub-project