The weird team balance comes from the system checking each sub role for each team, they can have at most difference of 1. However this system does not try to balance healers to tanks or ranged to melee. That's why you can get 1T1H3D vs 5D, but those 3D v 5D can't be something like 1 caster vs 3 casters for example.

It's been suggested before to tune the matchmaker further to get better ratio, but they have yet to do anything about it. Not to mention that some spesific Jobs like SGE completely throw sub role out of the window and queueing as one and being put against AST+WHM is absolutely awful.