Yes. Proper package manager usually proceeds to install only signed packages.
It means that usually OS maintainer has verified the purpose of the package.
It gives a quite lot more trust than running arbitrary content as shell script, without any third party verification.
The exact same problem exists with the channel that you acquire the public key you trust from. You’re still fundamentally trusting HTTPS to the package provider - you’re just trusting it at a different point.
Usually keyring is separate package which is also signed with a key which can be verified from multiple different sources.
Of course, if you are a target of nation state attack, which fakes public keys from all sources by MITMn DNSs and servers, you might end up with the wrong package.