Sure, you can easily devise state machines that would modify themselves at runtime (this is what often actually happens when you try to recode spaghetti code as a state machine).
Many libraries include code to detect differences between runtime environments, and remove the need for applications to allow for such inconsistencies.