There are a couple of things to say, here. First, what you claim to be your v3 configuration is actually a v2 configuration and will not affect version 3 in any way. Version 3 does not have MathJax.Hub, and does not have the HTML-CSS output renderer (only the CommonHTML one). MathJax version 3 is configured in a different way, see
and the configuration conversion tool at
so this v2 configuration will be completely ignored by version 3.
Second, version 3 does not yet implement the line breaking algorithm, see
so the breaking your re seeing is not due to MathJax. Since the math should not be broken, I can only assume that some CSS on the page is overriding MathJax's CSS to allow the browser to insert line breaks where MathJax would have prevented it. I can't tell without seeing the page. In any event, the line breaking is not being done by Mathjax, and that would account for the poor layout.
Finally, automatic line breaking within fractions is done to the full width of the available content, not to the space "left over" from other content. This is a last-ditch effort to get your content displayed, so can lead to sub-optimal layout, as in your second example. your first example only works well because the various terms have sufficient nesting to prevent internal line breaks, so there is enough left-over space for the function and equal sign; the second has longer terms, so there is no space left over. You can force line breaks in your fractions at better location, or could implement TeX macros that help control the breaking, as described in this post
There is more detail about how the line breaking works at
though this is a discussion about MathML rather than TeX input. In any case, the fact that fractions break to the full width of the container is not something you can change.
Davide