you have to provide more information like where is beforeExecuteRoute
in a controller or a extended class ?
because if this method in a controllerbase for instance it will be executed for each controller gets initiated
so i think the short answer for this you have to return false after the redirect to stop the execution
beforeExecuteRoute is an event that can be stopped check the documentation here
public function beforeExecuteRoute()
{
if (!$this->getCustomer()) {
$this->response->redirect("/login");
return false;
}
}