The logic here is similar to `#14007` in a way.

Shouldn't we solve this at the AppCache level with methods that are fully aware of package models?