Not sure if this is a bug - the only way to get the correct PoseBone's matrix after setting another PoseBone's matrix_basis (which in some way influences the former bone) is to call scene.update() after applying matrix_basis to one or many PoseBones.
At the very least, this should be noted in the Gotchas section on docs.blender.
Taking this into account - I have spotted a definite bug in the FBX export addon.
Looking through the FBX export addon file export_fbx_bin.py, I noticed the coder had tripped up with this same misconception.
After both instances of:
if pbones_matrices is not ...: for pbo, mat in zip(ob.pose.bones, pbones_matrices): pbo.matrix_basis = mat.copy()
scene.update() needs to be called immediately afterwards.
Assuming bake_anim_force_startend_keying = False and there are multiple actions being exported, the last frame of the previous action will influence the following action if one of the keying bones was not keyframed on the first frame.
This is very noticable when exporting a rigify rig for example, and creates bad exports.
Please see attached blend file for simple example (with code).