> I don't know that it's true that moving a lot means you work with more people.
It's generally true that you meet more people switching jobs every 2 years. You work with all the people that stayed and all the people that also left after 2 years. You end up on more total teams.
It's not universally true. If you stay in a place with higher than average turnover, constantly working with new people then you would be in an position to work with more people. Additionally, if you worked in a very centralized team in a very large software company you could end up working with more people.
Finally, the quantity of people you've worked with isn't the key metric you should maximize your professional network for. You ideally want in any 3 month period multiple people in your professional network whose recommendation will carry a lot of weight for an open position you would be interesting in taking that would give you a strong recommendation. After you've reached that level of baseline employment security then you want to maximize for people that will recommend better and better positions.