Fixing unwanted gaps/bridges in slicer

I found a solution to fix the issue!

Since I created the model using Python, it had a very high vertex count. I imported it into Blender, went into edit mode, selected all vertices, and then used X → Limited Dissolve.

While the model now looks even messier in Blender, it actually prints much better with proper top surfaces. You can see the comparison in the attached image.