Solved by StyleObserver: Element.matchContainer() – Bram.ushttps://www.bram.us/2025/02/24/solved-by-styleobserver-element-matchcontainer/
Martin Winkler published a package that polyfills Element.matchContainer to get notified in script when a Container Query matches/unmatches. Under the hood, it uses a StyleObserver.