Make pkg.installed state multiple-version aware

This commit uses the "versions_as_list" kwarg that was recently added,
so that version specification works as expected for instances where more
than one version of a package is installed.

This fixes #2783.