@rafaucau already did the work for his Litespeed cache extension https://discuss.flarum.org/d/29475-litespeed-cache-for-flarum
That extension is probably a very good starting point if someone wants to implement cache with a different system. Maybe the extension can even be used without change if the alternate system can read litespeed headers.
But yeah the two biggest challenges are probably finding a way to distinguish connected vs non-connected requests, as well as having a way to load the CSRF token when attempting any dynamic action from a cached page.
Flarum doesn't have built-in mechanism for either of those, and it's not really planned to change it at the moment. One reason we probably can't implement this fully in Flarum itself is extensions, because some extensions will depend on data that is preloaded but not cached, and it's super complicated to deal with this in a way that will work for all use cases. Extensions might also offer guest dynamic actions that aren't dependent on the user being logged in.