The MySQL database that associates WikiProjects with articles stores pages by title, rather than page ID. It should instead use the page ID of the WikiProject and the page ID of the page. This way, articles can be renamed and WikiProjects can be renamed and fewer things get broken.
There should also be a column for namespace; see T116668. The column for namespace will allow us to filter out pages by namespace where appropriate.