If a player leaves the game while on a team, team:GetPlayers() will still include them (for one frame). The expected behaviour is that they are no longer on the team (hence removed, not removing). This bug does not happen when explictly changing their team.
This is a small repro, a better one is attached below.
team.PlayerRemoved:Connect(function(player)
print(#team:GetPlayers()) -- (number before leaving)
wait()
print("Amount after delay", #team:GetPlayers()) -- (number - 1)
end)