How do you think most game scripting engines work?
Nowadays game engines don't rely on strictly speaking hardcoded behaviour, but rather are themselves just a scripting environment to execute a specific format of code.
Skyrim is still the perfect example because it gives you the ability to literally do anything in the world, via a scripting language.
Instructing NPCs to behave in a specific way is also done through these scripts. And LLMs - especially coding fine-tuned ones which could be tied into the execution chain - can easily translate things like <npc paces around> to specific instructions so the NPC walks up and down at a specific distance or in a circle or whatever you want it to do.
You're seriously over-estimating the work it takes on even crappy, but modern engines to get certain things to happen. Especially when it comes to things that are already dynamically scripted. Like NPCs.