How to impersonate ("become") a package on the commandline in Android

The /system/bin/run-as command lets you execute a shell or a package as the owner of the package. But you've to be root or use ADB to use it. And the package has to be debuggable and user owned (i.e. system apps cannot be impersonated like this).