I think it is done with the Anchors of the Rect Transform. I have tried all the possible combinations of the following default anchors:
Unfortunately, when I resize the button in the Scene, the text is always stretched:
You're misunderstanding how RectTransform works. The basic Transform properties (position, rotation, scale) affect all 2D/GUI children regardless of what settings they have, just like they do with regular GameObjects. Transform scaling thus completely ignores whatever anchors you have set on the children.
RectTransform anchors determine how the object changes in reaction to the parent being modified, allowing you to fine-tune this relationship. A Middle-Left anchor makes the child ignore changes to the top, bottom, and right sides of its parent, but will move with the left edge as if you had moved the entire parent. The various Stretch anchors allow slaving to two or more sides at once--so a Middle-Stretch anchor would leave the child unaffected by changes to the parent's left and right sides, but stretching along the top and bottom to match its parent.
So this means you almost never want to fiddle with the parent's scale (except for perhaps animations). Instead only change the parent's Width/Height/Left/Right/Top/Bottom parameters, and the child's anchors will do the rest.
(Shameless plug: I wrote a script here that helps make RectTransform manipulations easier in code.)