### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current Behavior

Lambda refs get lost

### Expected Behavior

Lambda refs work in state machines

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

    awslocal s3 mb s3://mybucket


### Environment

```markdown
- OS: 
- LocalStack:
```


### Anything else?

This is based on a conversation I had with @dominikschubert 
buckets = list()
    def factory(**kwargs) -> str:
        if "Bucket" not in kwargs:
            kwargs["Bucket"] = "test-bucket-%s" % short_uid()
        s3_client.create_bucket(**kwargs)
        buckets.append(kwargs["Bucket"])
        return kwargs["Bucket"]
    yield factory
    
    for bucket in buckets:
        try:
            s3_client.delete_bucket(Bucket=bucket)
        except Exception as e:
            LOG.debug("error cleaning up bucket %s: %s", bucket, e)
@pytest.fixture
def s3_bucket(s3_create_bucket) -> str: