I looked into the sources of the BabylonJS Spine integration.
For every attachment that is rendered for a skeleton, the z-coordinate is calculated like this:
https://github.com/klaude416/spine-runtimes/blob/3.6/spine-ts/babylonjs/src/SkeletonMesh.ts#L284
If you viewed such a skeleton from the side, you'd see this:
Loading Image
The gun would be drawn first, then the back leg is rendered with a bigger z-coordinate, and so on. This is required so there is no z-fighting between attachments.
If you draw 2 skeletons, those z-offsets won't result in what you expect.
You could try to make the SkeletonMesh.zOffset
smaller so that attachments from Skeleton B are guaranteed to be behind the attachments of Skeleton A.