This would be possible, with a macOS "Installer Plug-In", however it will not be an easy process.
Installer Plug-Ins allow you to create custom actions that are shown during the install process, as an additional step (such as after the "Read Me" or "License" step). However, in recent years Apple has not provided any documentation regarding the creation of custom installer plug-ins, likely because of the possible security risks they could expose by running arbitrary code. This means that while they are still fully supported as of macOS Tahoe, development has long-since stopped on them, and they could very well be removed in the future.
You can find examples on GitHub such as this registration code installer plug-in, but the common theme among any examples you come across will likely be how dated they are. As a result of this, the sample code is in Objective-C using Storyboards. You could possibly write the configuration data to a .plist file somewhere on disk, and then retrieve it later from your installed application. It may be possible to migrate this code to Swift, but this would require additional effort on your part.
I would recommend following the Installer Plug-In tutorial by Stéphane Sudre (the individual behind the incredibly useful Packages app). The resource was last updated in 2012, however almost nothing has changed about installer plug-ins since this guide was written.
You could technically prompt for user input via osascript in a pre/postinstall script, however this would likely result in an even worse end-user experience and could lead to many issues.