> How would you prevent this from happening?
Very simply - enforce security permissions at the OS level, rather than the app store level.
There's no technical reason an app store also has to handle permissions. Leave the discoverability/reviews/curation functionality in the app store, and then just move the app installation functionality into the OS - the app store delivers an app package which the OS accepts, parses the manifest file, prompts user for permissions.
Put APIs behind a sane, capabilities-like model where the OS has to approve everything.
Facebook and Google can make their own app stores - but they still won't be able to spy on you by using privileged APIs without your consent.
(yes, they'll still be able to spy on you using data collection and aggregation - but then Apple's App Store privacy labels becomes a differentiating feature that build user trust and add value to the system, and Apple could add a warning when you install another App Store "privacy labels don't transfer, etc.")