We present a study on the development of Finnish first-year physics majors' attitudes towards physics, as measured by the Colorado Learning Attitudes about Science Survey, before, during, and after the period of mandatory remote learning due to the coronavirus pandemic. We find that in the years before the pandemic, these attitudes did not change, but the period of extended remote learning due to the pandemic had a negative effect on the students' expertlike views. Similarly, the students who experienced the remote learning period in high school displayed a lower level of expertlike thinking as they entered university. As contact teaching resumed, moderate positive gains were seen, bridging some but not all of the gap in student attitudes left by the pandemic.