You're mixing two different Apex features: validations and branches.
If you want to check for a data entry error, you use a Validation - and generally the same page will be returned to the user so they can correct their error.
If you want to branch to another page, you use a Branch. If you want to branch to different pages depending on a condition, you can create multiple Branches, each with a condition. The first branch that satisfies its condition will be used.
In addition, if you want to do some processing before the branch, you create a Process. Typically a Process is run after the validations are done but before the branches are done.
In your case, you could put your code in a Process, and set a hidden item with a flag that is used by the Branches to work out which page to branch to.