Able to change dimensions, but not scale
You should apply dimensions first and then scale it.
Since set dimension kind of reset the scale to make it work in calculation.
import bpy
import bmesh
from bpy_extras.object_utils import AddObjectHelper
from bpy import context

bpy.ops.mesh.primitive_cube_add(size=16, enter_editmode=False, align='WORLD', location=(0, 0, 0))
# select the last created object
bpy.context.view_layer.objects.active = bpy.data.objects[-1]

bpy.context.object.location.xy = 0.0, 0.0
bpy.context.object.location.z = 8.6

bpy.context.object.dimensions.z = 2.0
bpy.context.object.scale.xy = 1250, 1250