What you are currently doing is setting the environment variable ROUTE_ID to nothing for the execution of jq, eg:
MY_ENV=abc command
Will set the environment variable "MY_ENV" to "abc" for the execution of command.
What you want to do is store the output of your command a variable, for this you'll need to use command substitutions:
my_var=$(command)
In your case:
route_id=$(jq -r '.[][]? | select(.pattern? == "test.com/testcards/email/").id' route.json)
Nitpicking; use lowercase variable names when possible, as UPPER_CASE are "reserved" for exported environment variables.