I don't see the same issue in Revit 2022:

Private Function Obj_210816c(ByVal commandData As Autodesk.Revit.UI.ExternalCommandData,
ByRef message As String, ByVal elements As Autodesk.Revit.DB.ElementSet) As Result
Dim UIDoc As UIDocument = commandData.Application.ActiveUIDocument
If UIDoc Is Nothing Then Return Result.Cancelled Else
Dim IntDoc As Document = UIDoc.Document
Dim Mats As New List(Of String)
Mats.Add("RT_Red,255,0,0")
Mats.Add("RT_Green,0,255,0")
Mats.Add("RT_Blue,0,0,255")
Mats.Add("RT_Cyan,0,255,255")
Dim FEC As New FilteredElementCollector(IntDoc)
Dim ECF As New ElementClassFilter(GetType(Material))
Dim MatsFound As List(Of Element) = FEC.WherePasses(ECF).ToElements.Where(Function(n) n.Name.StartsWith("RT_")).ToList
Dim NewMats As ElementId() = New ElementId(3) {}
Using tx As New Transaction(IntDoc, "Add materials")
If tx.Start = TransactionStatus.Started Then
Dim Commit As Boolean = False
Dim Ix As Integer = 0
For Each item As String In Mats
Dim Str As String() = item.Split(New Char() {","}, StringSplitOptions.None)
Dim M As Element = MatsFound.FirstOrDefault(Function(x) x.Name = Str(0))
If M Is Nothing Then
NewMats(Ix) = Material.Create(IntDoc, Str(0))
Commit = True
IntDoc.Regenerate()
Dim M1 As Material = IntDoc.GetElement(NewMats(Ix))
M1.Color = New Color(CByte(Str(1)), CByte(Str(2)), CByte(Str(3)))
Else
NewMats(Ix) = M.Id
End If
Ix += 1
Next
If Commit Then
tx.Commit()
Else
tx.RollBack()
End If
End If
End Using
Dim Size As Double = 1
Dim v1 As New XYZ((8 / 9) ^ 0.5, 0, -1 / 3)
Dim v2 As New XYZ(-(2 / 9) ^ 0.5, (2 / 3) ^ 0.5, -1 / 3)
Dim v3 As New XYZ(-(2 / 9) ^ 0.5, -(2 / 3) ^ 0.5, -1 / 3)
Dim v4 As New XYZ(0, 0, 1)
v1 *= Size
v2 *= Size
v3 *= Size
v4 *= Size
Dim F As XYZ(,) = New XYZ(3, 2) {{v4, v1, v2}, {v4, v2, v3}, {v4, v3, v1}, {v1, v2, v3}}
Dim TSB As New TessellatedShapeBuilder()
TSB.OpenConnectedFaceSet(True)
For i = 0 To 3
Dim EID As ElementId = NewMats(i)
TSB.AddFace(New TessellatedFace({F(i, 0), F(i, 1), F(i, 2)}.ToList, EID))
Next
TSB.CloseConnectedFaceSet()
TSB.Build()
Using tx As New Transaction(IntDoc, "Tetrahedron")
If tx.Start = TransactionStatus.Started Then
Dim DS As DirectShape = DirectShape.CreateElement(IntDoc, New ElementId(BuiltInCategory.OST_GenericModel))
DS.AppendShape(TSB)
tx.Commit()
End If
End Using
Return Result.Succeeded
End Function
TessellatedShapeBuilder.GraphicsStyleId will be set for whole shape i.e. can have Category with Material