There are going to be nefarious actors who still manage to bypass it, and there are going to be risks outside of a walled garden - and that's a meaningful choice we can provide users.
"Hey, you can stay inside the app store and get these promises, or you can install what you want and risk X, Y and Z."
Android does this.. decently well. There are issues with the google framework, but otherwise it's functional - my elderly family doesn't need me to reset their phones every month, yet I can sideload all my games and FOSS apps.
because you're only thinking of technical solutions. A comprehensive privacy framework that requires explicit user consent to data collection and gives user transparent controls accomplishes just that, without having to resort to user-hostile or complicated tech.