Reapply "[libc++] Fix incorrect size check when growing std::string" (#234545) (#234551)
There was a race condition with another commit adding another call of
`__get_amortized_growth_capacity`. This is fixed in this version.
Original commit message:
When trying to grow very large amounts the `max_size()` check could fail
due to
the result of adding the current capacity and the additional capacity
could wrap.
This reverts commit 64b40b84eb293e259cfe36add2ac34ab3dafc05c.