"Nesting" groups is not yet supported for Teams, so you cannot use this approach. You can "add" a group as member via the Teams client, but that simply takes the current membership of the group, so not what you are asking for. Instead, you can use Teams with Dynamic membership rules, as detailed here: https://learn.microsoft.com/en-us/azure/active-directory/enterprise-users/groups-dynamic-membership
In all cases, the group must be synced to Azure AD, you cannot use purely on-prem one.