Fixes rc version suffix and hyphen deletion in #22681
Does not address removal of copyright from --version output, since that is a new issue only affecting master/23.x, and #24263 seems like a better approach moving forward. (ie, this is mainly only for backporting purposes)