I mean that is exactly how it works. And if a private company wants to verify your age while violating the law they can do that already, just don’t use their service then.
https://github.com/swiyu-admin-ch contains far more than just the client. Only a certain component where they had to rely on a proprietary solution is closed source. Everything else is in the open.
You can not just say that it is a threat to privacy. Its design improves privacy as we finally can ID ourselves, where it has always been required, without actually giving our identity to online services.
You better us Consentomatic: https://consentomatic.au.dk/