### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current Behavior

When defining path parameter resources, for example:

 * `/documents/{documentId+}`
 * `/documents/search`

In CDK, the order of definition changes what LocalStack returns. If you define the path parameter `/documents/{documentId+}` before `/documents/search` and then try to hit `/documents/search`, LocalStack instead invokes the integration for `/documents/{documentId+}`, rather than the intended one.

However, if you define `/documents/search` before `/documents/{documentId+}` in CDK, LocalStack invokes the correct integration.

### Expected Behavior

In AWS, the order does not matter, and no matter which order they're defined in trying to hit `/document/search` will result in the integration for that resource being invokes.

### How are you starting LocalStack?

With a docker-compose file

### 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)

```ts
export class GatewayStack extends Stack {
  constructor(scope: Construct, id: string, props: StackProps) {
    super(scope, id, props);

    const api = new RestApi(this, "test-api", {
      restApiName: "test-api",
    });

    const getByIdLambda = new Function(this, "get-by-id-handler", {
      runtime: Runtime.NODEJS_20_X,
      code: Code.fromInline(
        "exports.handler = async () => ({ statusCode: 200, body: 'Get By Id' });",
      ),
      handler: "index.handler",
    });

    const searchLambda = new Function(this, "search-lambda-handler", {
      runtime: Runtime.NODEJS_20_X,
      code: Code.fromInline(
        "exports.handler = async () => ({ statusCode: 200, body: 'Search Results' });",
      ),
      handler: "index.handler",
    });

    const documents = api.root.addResource("document");
    const getById = documents.addResource("{documentId+}");
    const search = documents.addResource("search");

    getById.addMethod("GET", new LambdaIntegration(getByIdLambda));
    search.addMethod("GET", new LambdaIntegration(searchLambda));
  }
}
```

```sh
GATEWAY_ID=$(awslocal apigateway get-rest-apis --query "items[0].id" --output text)
curl https://$GATEWAY_ID.execute-api.localhost.localstack.cloud:4566/prod/document/search
```

### Environment

```markdown
- OS: Ubuntu 20.04
- LocalStack: 3.1
```


### Anything else?

I've reproduced the issue here: https://github.com/Garethp/localstack-bugs/tree/order-dependant-path-parts
If you clone down the branch `order-dependant-path-parts`, run `yarn install` and then `./start.sh` you should see the issue in action
schema=json.dumps(model_schema_house),
        )
        container.models[model_name_house] = model_house
        store = self._mock_store()
        store.rest_apis["deadbeef"] = container
        invocation_context = _create_context_with_data(
            {
                "name": "test",
                "house": {  
                    "contains": [{"name": "test"}],  
                    "houses": [{"coucou": "test"}],  
                },
            }
        )
        validator = RequestValidator(invocation_context, store)
        with pytest.raises(BadRequestBody):
            validator.validate_request()
        invocation_context = _create_context_with_data(
            {
                "name": "test",
                "house": {
                    "houseType": "random",  
                    "contains": [{"name": "test"}],  
                    "houses": [{"houseType": "test"}],  
                },
            }
        )
        validator = RequestValidator(invocation_context, store)
        assert validator.validate_request() is None
    def _mock_client(self):