### Summary

If you use `ansible-galaxy` to install a role to a path specified by both environment variable `ANSIBLE_ROLES_PATH` and `--roles-path=` galaxy will fail to extract the role, and infinitely loop trying to extract the archive.

### Issue Type

Bug Report

### Component Name

galaxy

### Ansible Version

```console
$ ansible --version
ansible 2.9.27
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/ncelebic/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/ncelebic/py3venv/lib/python3.8/site-packages/ansible
  executable location = /home/ncelebic/py3venv/bin/ansible
  python version = 3.8.10 (default, Sep 28 2021, 16:10:42) [GCC 9.3.0]
```


### Configuration

```console
$ ansible-config dump --only-changed
```


### OS / Environment

Ubuntu 20.04
Python 3.8 virtualenv 

### Steps to Reproduce

<!--- Paste example playbooks or commands between quotes below -->
```
mkdir roles
chmod -w roles
ANSIBLE_ROLES_PATH=./roles/ ansible-galaxy install geerlingguy.repo-epel --roles-path=./roles
```


### Expected Results

If you use just the env var `ANSIBLE_ROLES_PATH` it errors out with: 
```
/home/ncelebic/test/galaxy_test/roles/geerlingguy.repo-epel: [Errno 13] Permission denied:
'/home/ncelebic/test/galaxy_test/roles/geerlingguy.repo-epel'
```

That is the expected outcome

### Actual Results

```console
$ ANSIBLE_ROLES_PATH=./roles/ ansible-galaxy install geerlingguy.repo-epel --roles-p
ath=./roles
- downloading role 'repo-epel', owned by geerlingguy
- downloading role from https://github.com/geerlingguy/ansible-role-repo-epel/archive/3.1.0.tar.gz
- extracting geerlingguy.repo-epel to /home/ncelebic/test/galaxy_test/roles/geerlingguy.repo-epel
- extracting geerlingguy.repo-epel to /home/ncelebic/test/galaxy_test/roles/geerlingguy.repo-epel
- extracting geerlingguy.repo-epel to /home/ncelebic/test/galaxy_test/roles/geerlingguy.repo-epel
- extracting geerlingguy.repo-epel to /home/ncelebic/test/galaxy_test/roles/geerlingguy.repo-epel
- extracting geerlingguy.repo-epel to /home/ncelebic/test/galaxy_test/roles/geerlingguy.repo-epel
- extracting geerlingguy.repo-epel to /home/ncelebic/test/galaxy_test/roles/geerlingguy.repo-epel
- extracting geerlingguy.repo-epel to /home/ncelebic/test/galaxy_test/roles/geerlingguy.repo-epel
- extracting geerlingguy.repo-epel to /home/ncelebic/test/galaxy_test/roles/geerlingguy.repo-epel
- extracting geerlingguy.repo-epel to /home/ncelebic/test/galaxy_test/roles/geerlingguy.repo-epel
- extracting geerlingguy.repo-epel to /home/ncelebic/test/galaxy_test/roles/geerlingguy.repo-epel
- extracting geerlingguy.repo-epel to /home/ncelebic/test/galaxy_test/roles/geerlingguy.repo-epel
- extracting geerlingguy.repo-epel to /home/ncelebic/test/galaxy_test/roles/geerlingguy.repo-epel
- extracting geerlingguy.repo-epel to /home/ncelebic/test/galaxy_test/roles/geerlingguy.repo-epel
- extracting geerlingguy.repo-epel to /home/ncelebic/test/galaxy_test/roles/geerlingguy.repo-epel
- extracting geerlingguy.repo-epel to /home/ncelebic/test/galaxy_test/roles/geerlingguy.repo-epel
- extracting geerlingguy.repo-epel to /home/ncelebic/test/galaxy_test/roles/geerlingguy.repo-epel
- extracting geerlingguy.repo-epel to /home/ncelebic/test/galaxy_test/roles/geerlingguy.repo-epel
- extracting geerlingguy.repo-epel to /home/ncelebic/test/galaxy_test/roles/geerlingguy.repo-epel
- extracting geerlingguy.repo-epel to /home/ncelebic/test/galaxy_test/roles/geerlingguy.repo-epel
... forever
```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct
"""
        Downloads the archived role to a temp location based on role data
        """
        if role_data:
            
            if self.download_url is not None:
                archive_url = self.download_url
            elif "github_user" in role_data and "github_repo" in role_data:
                archive_url = 'https://github.com/%s/%s/archive/%s.tar.gz' % (role_data["github_user"], role_data["github_repo"], self.version)
            else:
                archive_url = self.src
            display.display("- downloading role from %s" % archive_url)
            try:
                url_file = open_url(archive_url, validate_certs=self._validate_certs, http_agent=user_agent())
                temp_file = tempfile.NamedTemporaryFile(delete=False)
                data = url_file.read()
                while data:
                    temp_file.write(data)
                    data = url_file.read()
                temp_file.close()
                return temp_file.name
            except Exception as e:
                display.error(u"failed to download the file: %s" % to_text(e))
        return False
    def install(self):