Looks like rECOE800f6cb1b8f4: Simplify function Captcha::loadText for readability introduced a bug in SimpleCaptcha::loadText() where passing false for $section (as the calling code path via confirmEditMerged() does, despite @param documentation specifying strings) would start loading section 0 instead of using the whole page.
That means the $wgCaptchaRegex check where it tries to count only added instances of the regex will not work right because the $oldtext contains only the lead section while $newtext contains the whole page content.
This might be fixed by adjusting the check, or by fixing confirmEditMerged() to pass a string rather than false.