Since the beginning of Android apps could see what other apps were installed on your phone without asking for special permission.
They finally added a permission for it - QUERY_ALL_PACKAGES - in Android 11 (2020). Unfortunately it's one of those stupid permissions like filesystem access where you have to apply for it via a form, and only whitelisted use cases are allowed:
> Permitted uses involve apps that must discover any and all installed apps on the device, for awareness or interoperability purposes may have eligibility for the permission. Permitted uses include device search, antivirus apps, file managers and browsers.
I suppose that situation is slightly better than "anyone can do it for any reason".
They finally added a permission for it - QUERY_ALL_PACKAGES - in Android 11 (2020). Unfortunately it's one of those stupid permissions like filesystem access where you have to apply for it via a form, and only whitelisted use cases are allowed:
> Permitted uses involve apps that must discover any and all installed apps on the device, for awareness or interoperability purposes may have eligibility for the permission. Permitted uses include device search, antivirus apps, file managers and browsers.
I suppose that situation is slightly better than "anyone can do it for any reason".