I can not answer the part regarding
replace-match, but I found the underlying issue.
In my config I use
straight.el to configure my packages. I had something along the following lines written there:
org is built in, there's no need to pull it from straight. I could fix my problem by changing the configuration like that:
:straight (:type built-in)
org from straight fetches the latest version 9.5.4, whereas the built-in version is 9.5.2. Apparently some changes in 9.5.3 or 9.5.4 trigger the endless loop.
Digging a little deeper, this is a sample configuration that reproduces the problem:
;; ------ bootstrapping straight -------------
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(unless (file-exists-p bootstrap-file)
(load bootstrap-file nil 'nomessage))
;; -------- bootstrapping ends here ------------
I could narrow it down to
org v9.5.4. If you start emacs with this configuration, create or open an org file and try to add a new row in a table, your emacs should freeze.