This idea won't creake an "APK" for each app the user creates, but it may be something that you might like...
The below is an in-app interpreter/script builder/runner that allows users to "create" programs (scripts) that run in the interpreter:
BasicIDE Suite 3 now superceded by BasicIDE Suite 4 https://www.b4x.com/android/forum/threads/basicide-suite-4-now-even-further-improved.134964/ Here we have (yet) another updated version of BasicIDE Suite, my on device development environment. The IDE is based on my CodeEditorView control...
www.b4x.com
So, when the user completes the series of tasks in your app, your app will then write the generated interpreter "scripts" to a file. These scripts are basically the users "app"
Then you would make a "runtime" APK that simply includes the above interpreter and it will load these "script" files and run them.
This way the runtime APK stays the same so you won't have to generate a different APK for each user app. But this runtime APK will seem like a different app when it loads in different generated user scripts written by your app.
I hope this makes sense.