(Python API) Importing, Setting Pivot Point, Locating and Rotating
I suspect that all of the points in the geometry are relative to the origin, but that likely does not explain the problem you are experiencing.   I found this function on the web, it seems to move the pivot point without the problems you are experiencing.
import bpy
from mathutils import Vector, Matrix

def set_origin(ob, global_origin=Vector()):
    mw = ob.matrix_world
    o = mw.inverted() @ Vector(global_origin)
    ob.data.transform(Matrix.Translation(-o))
    mw.translation = global_origin
    
# call the function:
set_origin(bpy.context.object)