I know the code is not ideal since everyone who calls
forgetRememberedArchivedReportsToInvalidate would need to know to ideally also invalidate the general tracker cache. On the other side we're seeing quite a lot of invalidations like sometimes 50 invalidations within a few ms causing heaps of cache invalidations and cache re-generations across many servers within few ms potentially resulting in locks and temporary performance issues.
Maybe this helps to prevent also things like #15545
@diosmosis maybe you can have a look? Maybe since the code is only used internally it may be fine like that?
Looks good to me, some suggestions:
getRememberedArchivedReportsOptionFromTracker(). It is cleared again anyway at the end of the method that calls it here: https://github.com/matomo-org/matomo/blob/4f879e1db8600f21b3a09711b43bcc63282682a1/core/Archive/ArchiveInvalidator.php#L118.