Answer from Microsoft Support:
The API that you are using does not allow for adding guest users in this way Update document to state that guest members cannot be added to a team with app permissions · Issue #11757 · microsoftgraph/microsoft-graph-docs · GitHub -> https://github.com/microsoftgraph/microsoft-graph-docs/issues/11757
You will need to add the member using the Group API instead, and the cmdlet respective to the API will be New-MgGroupMember (Microsoft.Graph.Groups) | Microsoft Learn -> https://learn.microsoft.com/en-us/powershell/module/microsoft.graph.groups/new-mggroupmember?view=graph-powershell-beta
The only caveat is that the guest users will get a Teams notification saying that "Unknown has added you to a Team". Also, for a user to sync from a Group to a Team, it can take up to 48 hours.