How can I have empty nodes in the skeleton hierarchy

I am creating an fbx exporter for my program, so that I can use the fbx files in Unreal.

My hierarchy goes something similar to this:

  • Joint_1
    • Mesh_1
    • Joint_2
      - Mesh_2

Both the joints are empty points, and the animation keyframes are applied to the joints. The meshes are parented under each joint with no animation keyframes applied to them.
When I import this fbx into Unreal, I get multiple animation sequence files and multiple skeleton files. The skeleton files only contain the Meshes(a single one per file, so one skeleton has Mesh_1, and the other has Mesh_2, and nothing else) and not the Joints.
I tried to make a similar thing in blender with the same hierarchy and I got the same results.

If I skip the joints and make the animation curves straight on the meshes while changing my hierarchy to only include the meshes, then it imports in as a single Animation Sequence, with a single skeleton file with both the Meshes in the bone hierarchy.
Similar object made in blender works fine too.
So the hierarchy that works looks like:

  • Mesh_1
    • Mesh_2

Note, these objects are not skinned, they are simple objects that are just parented under the other.

How do I make this work with the original hierarchy, meshes parented under the joints, and the animation applied to the joints?