The uninstall operation needs to inherit DPKG_ENV_VARS set above as install and upgrade currently do. Without this packages that prompt on removal cause that state to hang. resolvconf in particular prompts you with a warning about rebooting your system after removal.
Merge pull request #19042 from JaseFace/aptpkg-uninstall-env-vars

The aptpkg uninstall operation needs to inherit DPKG_ENV_VARS set above as install and upgrade currently do.