### 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
HOST_REGEX_EXECUTE_API = r"(?:.*://)?([a-zA-Z0-9]+)(?:(-vpce-[^.]+))?\.execute-api\.(.*)"
PATH_REGEX_MAIN = r"^/restapis/([A-Za-z0-9_\-]+)/[a-z]+(\?.*)?"
PATH_REGEX_SUB = r"^/restapis/([A-Za-z0-9_\-]+)/[a-z]+/([A-Za-z0-9_\-]+)/.*"
PATH_REGEX_AUTHORIZERS = r"^/restapis/([A-Za-z0-9_\-]+)/authorizers/?([^?/]+)?(\?.*)?"
PATH_REGEX_VALIDATORS = r"^/restapis/([A-Za-z0-9_\-]+)/requestvalidators/?([^?/]+)?(\?.*)?"
PATH_REGEX_RESPONSES = r"^/restapis/([A-Za-z0-9_\-]+)/gatewayresponses(/[A-Za-z0-9_\-]+)?(\?.*)?"
PATH_REGEX_DOC_PARTS = r"^/restapis/([A-Za-z0-9_\-]+)/documentation/parts/?([^?/]+)?(\?.*)?"
PATH_REGEX_PATH_MAPPINGS = r"/domainnames/([^/]+)/basepathmappings/?(.*)"
PATH_REGEX_CLIENT_CERTS = r"/clientcertificates/?([^/]+)?$"
PATH_REGEX_VPC_LINKS = r"/vpclinks/([^/]+)?(.*)"
PATH_REGEX_TEST_INVOKE_API = r"^\/restapis\/([A-Za-z0-9_\-]+)\/resources\/([A-Za-z0-9_\-]+)\/methods\/([A-Za-z0-9_\-]+)/?(\?.*)?"
INVOKE_TEST_LOG_TEMPLATE = """Execution log for request {request_id}
        {formatted_date} : Starting execution for request: {request_id}
        {formatted_date} : HTTP Method: {http_method}, Resource Path: {resource_path}
        {formatted_date} : Method request path: {request_path}
        {formatted_date} : Method request query string: {query_string}
        {formatted_date} : Method request headers: {request_headers}
        {formatted_date} : Method request body before transformations: {request_body}
        {formatted_date} : Method response body after transformations: {response_body}
        {formatted_date} : Method response headers: {response_headers}
        {formatted_date} : Successfully completed execution
        {formatted_date} : Method completed with status: {status_code}
        """
APIGATEWAY_SQS_DATA_INBOUND_TEMPLATE = (
    "Action=SendMessage&MessageBody=$util.base64Encode($input.json('$'))"
)
TAG_KEY_CUSTOM_ID = "_custom_id_"
EMPTY_MODEL = "Empty"
ERROR_MODEL = "Error"
class OpenAPIExt: