You can do that from a container without a problem. This is kinda similar to how our WiFi Connect project works: https://github.com/balena-io/wifi-connect
The NetworkManager service that handles WiFi management on balenaOS runs on the host OS, but you may communicate with it through D-Bus - e.g. create a hotspot with its own network. The concept is explained here: https://www.balena.io/docs/reference/OS/network/2.x/#changing-the-network-at-runtime
You may take a look and derive code from the Python WiFi Connect project done by one of our users: https://github.com/OpenAgricultureFoundation/python-wifi-connect
In addition to talking with NetworkManager (through D-Bus or better through a library on top of it like python-networkmanager), you will need to spawn an instance of dnsmasq, so that IP configuration could be assigned to devices connected to your network. Both WiFi Connect projects do that as well.
Please note that it will take you some time to implement all of this, but you can definitely achieve what you are looking for. Also in case you have any questions you can always ping us here.