When an armor stand has CustomNameVisible set to true:
When an armor stand is added to a team1 and then the nametagVisibility modifier is set to hideForOtherTeams, team2 can still see the team1 nametag.
When an armor stand has CustomNameVisible set to false:
The name isn't visible at all, regardless of team. This also applies when seeFriendlyInvisibles is set to true, the name is not visible.
I can confirm, 1.17.1.