Since the patch changes branches that were formerly mingw but not
cygwin, I guess that the patch is aiming for changing the case where
msys is used in its normal use case targeting MSVCRT. If I have
assumed wrong here, then the patch is clearly suspect.
Your assumption is right, the patch is intended for an MSVCRT target. I was using a hybrid system, where the shell is MSYS2 but gcc was coming from elsewhere, and targetted MSVCRT. MSYS2's default gcc targets libmsys-2.0.dll instead, and targetting MSVCRT is in practice cross-compiling. So no need for the patch, just pass the correct --host to configure.