I’ll admit this is definitely outside of my skillset to help diagnose.
If this is helpful at all, I found someone online who details their method of greedy meshing and links their source code in the video description. Maybe it would be helpful to compare the two.
I wish you luck in figuring this out! If you do find a solution, I would love an update here.