Can you have variables in filenames

I’m curious if I can somehow get filenames in a render to be based on what is visible.

So lets say I have 5 collections. Lights, cameras, groundPlane, standard, and fancy
I’d like my render output to be something like:
but the input would be something more like [active camera][ProductOption][groundPlane on off].exr
So without changing the file names, if I change the camera, turn off the ground plane, and switch the product option it might look like:
3Qperspective01_fancy_.exr (yeah, I realized halfway through that it would end up with the underscores anyway, but wanted to be consistent so it still made sense)

Is something like that possible without creating your own 700 line python script?

It would make compositing and outputting multiple things at once easier for sure. For all I know, something like this is already built in and I just don’t know what to call it for searching.