Since 2018 more than 1,500 teachers have stopped working in Scottish schools within five years of entering the classroom.