Refresh an F-curve with Python after changing Extrapolation Mode
You don't set the coordinates for the handles.

Blender won't check if these are valid. In this case the right handle is initialized with the default value
(0.0, 0.0) which is invalid since the  x-coordinate of the left endpoint is 10.0. So handle_x > endpoint_x is violated here. 

Moving the point blender will automatically recalculate the handles for the points.

BTW: keyframe_points.insert will recalculate the curve unless the option FAST is chosen.

This example works:

import bpy

obj = bpy.context.object
obj.animation_data_create()
obj.animation_data.action = bpy.data.actions.new(name="MyAction")
fcu_z = obj.animation_data.action.fcurves.new(data_path="location", index=2)
fcu_z.extrapolation='LINEAR'
fcu_z.keyframe_points.insert(10.0, 0.0)
fcu_z.keyframe_points.insert(20.0, 1.0)