If the value used by UniqueValueRenderer is set using a function, the labels specified for each value in the renderer are not shown in the legend when the map is printed.
Bug ID Number
September 10, 2015
December 1, 2020
After review by the development team, it has been determined that this issue is related to a known limitation with the software that lies outside of Esri's control. The issue's Additional Information section may contain further explanation.
Similar to ENH-000089970 - No direct way to accomplish this using the API.