The obvious answer is "use the Shape Builder" tool, but... The problem is that I actually have a blob of ~5000 shapes that all need to be welded together as one, and drawing all the lines across all the shapes needed to connect Shape Builder is incredibly tedious. What I really want is "just automate Shape Builder and weld together every selected space that is the same fill color." Is there a way to do that?
Select all shapes that you want make one. Then in the Pathfinder panel (Window >> Pathfinder) click shape mode "Unite". Holes (=compound paths) will survive and the common stroke, too. Your example is united in less than 1 second including the selection. (Note: The Pathfinder Panel has nothing to do with Effects >> Pathfinder.)
If there happens to be differently colored objects here and there that you want to keep separate, you can select one red shape and take the rest along by Select > Same > Fill Color.
ADD: If we watch the example more careful and assume that there's no error we noticet that white shapes have lost their strokes.
That's no problem, if they were separate objects. One can select all white and remove the black stroke. But if they were holes, a little tinkering is needed:
After uniting the red shapes the holes are intact. They must become strokeless separate objects. They must be done all at the same time because there's maybe hundreds of them.
Draw a big strokeless white rectangle, arrange it to back. I made an yellow rectangle to make it visible.
Duplicate (=copy and paste in place) the red shape, subtract the top red shape from the rectangle in pathfinder, ungroup the result, delete the outer remainder of the rectangle
Copy the pieces in the holes (select by the same color) to the clipboard, change their color to red in the drawing
Unite the red shape and the hole fills
Paste in place the pieces from the clipboard
Select all your shapes... then Pathfinder Panel > Merge
Merge will combine all objects with the same fill color into one object. If you select objects with different fill colors, each separate fill color will result in separate merged objects. You may need to reapply any stroke after the operation.
For more descriptions regarding the Pathfinder Operations see here: In Pathfinder window, what is the difference between a shape mode and a pathfinder?
The Shape Builder tool was added later to illustrator as an "on-the-fly" pathfinder tool. It essentially does what the Pathfinder panel options do, but more as a brush than a single button click.