### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current Behavior

Currently the VTL template for `request_templates` is not processed properly:

```
#set( $body = $input.json("$") )

#macro( loop $map )
{
    #foreach($key in $map.keySet())
        #set( $k = $util.escapeJavaScript($key) )
        #set( $v = $util.escapeJavaScript($map.get($key)).replaceAll("\\'", "'") )
        "$k": "$v"
        #if( $foreach.hasNext ) , #end
    #end
}
#end

{
    "enhancedAuthContext": #loop($context.authorizer),

    "headers": #loop($input.params().header),

    "query": #loop($input.params().querystring),

    "path": #loop($input.params().path),

    "identity": #loop($context.identity),

    "stageVariables": #loop($stageVariables),
}
EOF
}
```

results in,

```
'

{
    "enhancedAuthContext": {
    }
,

    "headers": {
    }
,

    "query": {
    }
,

    "path": {
    }
,

    "identity": {
    }
,

    "stageVariables": {
    }
,
}
'
```

### Expected Behavior

The template should be rendered and have the JSON properties.

### How are you starting LocalStack?

Custom (please describe below)

### Steps To Reproduce

#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)

    docker run localstack/localstack

#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)

    awslocal s3 mb s3://mybucket


### Environment

```markdown
- OS: MacOS
- LocalStack: 0.14
```


### Anything else?

This example can be used to validate.
https://github.com/localstack/localstack-terraform-samples/tree/master/apigateway-lambda-velocity
"""Return URL for inbound API gateway for given API ID, stage name, and path with custom dns
    format"""
    pattern = "http://{endpoint}{stage}{path}"
    stage = stage_name and f"/{stage_name}" or ""
    return pattern.format(endpoint=get_execute_api_endpoint(rest_api_id), stage=stage, path=path)
def get_execute_api_endpoint(api_id: str, protocol: str = "") -> str:
    port = config.get_edge_port_http()
    return f"{protocol}{api_id}.execute-api.{LOCALHOST_HOSTNAME}:{port}"
def tokenize_path(path):
    return path.lstrip("/").split("/")
def extract_path_params(path: str, extracted_path: str) -> Dict[str, str]:
    tokenized_extracted_path = tokenize_path(extracted_path)
    
    path_params_list = [(i, v) for i, v in enumerate(tokenized_extracted_path) if "{" in v]
    tokenized_path = tokenize_path(path)
    path_params = {}
    for param in path_params_list:
        path_param_name = param[1][1:-1]
        path_param_position = param[0]
        if path_param_name.endswith("+"):
            path_params[path_param_name.rstrip("+")] = "/".join(
                tokenized_path[path_param_position:]
            )
        else:
            path_params[path_param_name] = tokenized_path[path_param_position]
    path_params = common.json_safe(path_params)
    return path_params
def extract_query_string_params(path: str) -> Tuple[str, Dict[str, str]]: