I don't know a lot about fastcgi, but looking it up it seems like it also keeps a persistent process running to avoid execution overhead, but I don't know how that process is managed 🤷♂️
Either way, you could use a supervisor of sorts that shuts down the process/container after some idle time (at least for containers I know some exist) and that should probably work fine (outside of interrupting scanning operations).
I haven't tried it myself yet though :)