It is possible to have this feature built-in to the browser. I am surprised it has not been implemented yet (?).
Browsers used to commonly support user stylesheets. Chrome removed it a long time ago, and I'm not sure what the status of that is in Firefox now. The issue is that there's no single common use case for them, and if there were, it would be simpler to build it in. But maintaining that level of flexibility has a continuing cost...
I am referring to the fact that there are more or less simple algorithms you can use to determine the dark version of colors, or rather, perceptually darker variants (e.g. APCA). The browser could make the contrast threshold configurable.
Firefox appears to support a light and dark mode, custom foreground and background colors, and setting a default font face and size. Nothing like full user stylesheet support, at least not without extensions.
It does support the userContent.css file in the profile, there's just no UI for it.
There was a Chrome experiment for it when I looked last year; it worked well in some cases and was just as bad at Google Sheets as every other generic darkmode solution.