Fix error where routes would be incorrectly parsed.

Instead of only trying the first path partition, we should check each
matching prefix slice until all path prefixes have been exhausted.

Fixes #3954
Merge pull request #3961 from cakephp/issue-3954-parse-issue

Fix error where routes would be incorrectly parsed.