You could try:
polygon->NonDegenerateTriangulate(polygonIds);
It seems VTK 9.5 has made this incompatible change.