Getting autogenerated function already exists error

I have a service with the following configuration and it looks like, according to the documentation, a hidden function gets created: content-dev-custom-resource-existing-s3 with logical id: CustomDashresourceDashexistingDashs3LambdaFunction

So when I want to change the environment company variable from company1 to company2, even if the s3 buckets are completely different, I get the following error:

An error occurred: CustomDashresourceDashexistingDashs3LambdaFunction - content-dev-custom-resource-existing-s3 already exists in stack arn:aws:cloudformation:us-west-2…

Is there any way I could change that autogenerated logical id (CustomDashresourceDashexistingDashs3LambdaFunction) to depend on some environment variables?

Here is some of my serverless.yml configuration

service: content
provider:
  name: aws
  stackName: content-${self:provider.stage}-${self:provider.environment.COMPANY}
  stage: dev
  environment:
    COMPANY: company1
functions:
  myFunction:
    handler: src/handler.myFunction
    name: ${self:provider.stage}-${self:provider.environment.COMPANY}-myFunction
    events:
     - s3:
         bucket: ${file(./env.${self:provider.stage}.${self:provider.environment.COMPANY}.json):BUCKET}
         event: s3:ObjectCreated:Put
         rules:
         - prefix: content/
         existing: true