I don't think there's any way to do that with an expression.
There's no direct expression access to that function (probably possible with scripting, but likely wouldn't be the elegant solution you're hoping for).
The solutions for this are usually a bit hacky and annoying - fortunately, I recently stumbled onto this preset, which makes it easy! https://rossowens.gumroad.com/l/textbox
that's interesting, thanks
The only thing you could do with expressions would be to tie the layer's scale to the sourceRectAtTime().width of the layer so that the true size would always be the same. Two words would scale up until they were 500 pixels wide, and four words would scale down until they were 500 pixels wide. I almost never write an expression using sourceRectAtTime() that does not combine ".left, .right, height, width and scale * .01" to compensate for layer scale. It should not be difficult to reverse the process. You could not force a line feed, but you could keep a text layer the same width no matter how many characters were in it. It might be an interesting visual effect.
Here's the basic starting point for all my sourceRectAtTime() expressions.
ref = thisComp.layer(index - 1); refPos = ref.position; refSize = ref.sourceRectAtTime(); xOfst = refSize.width / 2 + refSize.left; yOfst = refSize.height / 2 + refSize.top; x = xOfst; y = yOfst; refPos + [x, y]
The expression centers the Anchor point of any layer below a text layer over the center of the text.
If you want to fiddle with expressions maybe that will get you started.