Kobik has used her reality altering powers to make Steve think that he was always loyal to Hydra and the Skull. It's not clear if she just changed Steve's memories but she might have actually changed the past itself so the flashbacks might have "really" happened.