Trackkit is what I built to solve it. You switch providers by changing config, not code. It handles queue-first event capture with consent gating, SSR queue serialization and client-side replay, and optional typed event maps for compile-time checking. And it's a client library only, so no new services or infrastructure.
I've been testing it against my own projects, but I'm sure there are integration patterns and edge cases I haven't hit. If you try it and something breaks or feels wrong, please let me know. Issues and discussions are open on the repo.