The update of the mac port for emacs 27.2 includes this probably-interesting note:

*** New hook mac-effective-appearance-change-hook.
Contributed by Peter Hardy.

It looks like the code is in mac-win.el, viewable here: https://bitbucket.org/mituharu/emacs-mac/raw/a124e5d0ccb820095be99c78d51abfd36ee22d9b/lisp/term/mac-win.el

HTH,
~Chad