### Summary

Using `apt` with `only_upgrade: yes` fails if a package is currently not installed. It seems this was recently introduced with https://github.com/ansible/ansible/pull/78327. For us this was a breaking change - was this intentionally?

### Issue Type

Bug Report

### Component Name

apt

### Ansible Version

```console
$ ansible --version
ansible [core 2.13.4]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/vagrant/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/vagrant/.local/lib/python3.8/site-packages/ansible
  ansible collection location = /home/vagrant/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.8.10 (default, Jun 22 2022, 20:18:18) [GCC 9.4.0]
  jinja version = 3.1.2
  libyaml = True
```


### Configuration

```console
# if using a version older than ansible-core 2.12 you should omit the '-t all'
$ ansible-config dump --only-changed -t all
empty for me
```


### OS / Environment

ubuntu/focal64 20220804.0.0 (vagrant box)

### Steps to Reproduce

<!--- Paste example playbooks or commands between quotes below -->
```yaml (paste below)
- name: upgrade if installed
  apt:
    name: "{{ packages }}"
    only_upgrade: yes
  vars:
    packages:
      - foo # not installed
      - bar
```


### Expected Results

no failure if a package is currently not installed

### Actual Results

```console
TASK [my_role : upgrade if installed.] ***********************************************************************************************************************
fatal: [127.0.0.1]: FAILED! => {"cache_update_time": 1663062238, "cache_updated": false, "changed": false, "msg": "no available installation candidate for foo"}
```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct
"""
    :return: A tuple of (installed, installed_version, version_installable, has_files). *installed* indicates whether
    the package (regardless of version) is installed. *installed_version* indicates whether the installed package
    matches the provided version criteria. *version_installable* provides the latest matching version that can be
    installed. In the case of virtual packages where we can't determine an applicable match, True is returned.
    *has_files* indicates whether the package has files on the filesystem (even if not installed, meaning a purge is
    required).
    """
    try:
        # ge
        # lo
        # st
        # hi
        pkg = cache[pkgname]
        ll_pkg = cache._cache[pkgname]  # th
    except KeyError:
        if state == 'install':
            try:
                provided_packages = cache.get_providing_packages(pkgname)
                if provided_packages:
                    # Wh
                    # on
                    # pa
                    if cache.is_virtual_package(pkgname) and len(provided_packages) == 1:
                        package = provided_packages[0]
                        installed, installed_version, version_installable, has_files = \