Landscape type objects don't reflect changes in CustomDepthStencilValue

For regular objects of type UMeshComponent I can set CustomDepthStencilValue like this and the changes gets rendered immediately.

mesh->SetCustomDepthStencilValue(object_id);
mesh->SetRenderCustomDepth(true);

However for Landscape type objects, first we don’t have above methods available, instead we must set the public fields directly. Above, SetRenderCustomDepth internally marks the object as dirty for rendering. Unfortunately Landscape type objects have no equivalent methods. So when we execute below code, the fields do get set but they don’t get reflected in rendering.

landscape->CustomDepthStencilValue = object_id;
landscape->bRenderCustomDepth = true;

This seems to be a bug in Unreal APIs. How do we work around this or fix it?