Apps use undocumented APIs to track which apps you’re using and prevent you from opening certain apps, Apple realises this is a potential security/privacy problem, so builds screentime into the OS so it can plug the security hole.
What they should have done is allow apps access to the screentime data if the user gives permission to the app to manage screentime.