How to add footprint programmatically

I have the feeling you do not fully understand kicads library system. Maybe this will help: Library management in KiCad version 5

The short version of what i assume you miss:
Footprints are only available in the add footprint dialog if they are placed inside a library that is known to KiCad. Which means they need to be stored in a .pretty directory (reachable by your file system, which most likely means somewhere on your hard drive). You also need to point to this .pretty directory from the library table.

You can load footprints into the pcb without them being available to that dialog because your python script stores them directly into the pcb file instead of into a library. (or at least this is how i understand your description)