Here is my solution to it. It will rotate the object around the given Pivot using the objects own rotation. E.g. A delta rotation around Z will rotate around the objects Z axis. Optionally you can retain the rotation of the object itself.
You can write this as a function, for sure.
UFUNCTION(BlueprintPure)
static void RotateAroundPivot(const FTransform& Original, const FVector PivotLocation, const FRotator DeltaRotation, bool bRetainOrientation, FTransform& New)
{
FTransform PivotTransform = FTransform(Original.GetRotation(), PivotLocation);
FTransform DeltaPivotToOriginal = Original * PivotTransform.Inverse();
New = FTransform(DeltaRotation.GetInverse() * (float)bRetainOrientation, FVector(0,0,0)) * DeltaPivotToOriginal * FTransform(DeltaRotation, FVector(0,0,0)) * PivotTransform;
}
