In Teams, you can adjust how assignments handle students added to the class after the assignment has been created. If you edit the assignment, the option should appear below that will let you choose if students should or should NOT be added to the assignment on joining the class: