How to get transform values that would be set from inserting visual key-frame for pose bones?
The page of PoseBone.matrix says


  Final 4x4 matrix after constraints and drivers are applied (object space)


You can convert the matrix from object space to local space calling Object.convert_space 

Edit

The comment of convert_space explicitly states that this can not be used for visual keyframing. For the simplest options with


Inherit Rotation
Inherit Scale


enabled. You can get the local transform for the bone like this



def get_mat_offset(pose_bone):
    """ calculate the (local) rest matrix of the bone 
        needs to be multiplied with the parent's pose matrix
        to get the rest matrix in armature space """
    bone = pose_bone.bone
    mat_offset = bone.matrix.to_4x4()
    mat_offset.translation = bone.head.copy()
    mat_offset.translation.y += bone.parent.length
    return mat_offset

pb = obj.pose.bones['Bone.001']

if pb.parent:
    mat_offset = get_mat_offset(pb)
    mat_pose_parent = pb.parent.matrix

    mat_rest_inv = mat_pose_parent * mat_offset
    mat_rest_inv.invert()

    matrix_basis = mat_rest_inv * pb.matrix

else:
    matrix_basis = pb.bone.matrix_local.inverted() * pb.matrix


Further you can decompose the matrix calling mathutils.Matrix.decompose

loc, rot, scale = mat_basis.decompose()