Not necessarily - real gene therapies that are in use now are carefully designed so that modifications are not inherited. For example, Casgevy which targets blood stem cells to treat sickle cell anemia. Because the treatment is limited to specific types of cells modifications don’t get into the germ line.
I was reading this thread thinking, “this isn’t the time to recommend NixOS that’s not what OP asked about.” But if you’re using Ansible this way NixOS might be a good fit for you. It’s got the advantages of the other immutable distros with the added feature of managing everything through a declarative configuration.