What OS vendors should do is give as bare bone version of SO - kernel + package manager. We can take it from there with scripts. With simple strategy to keep those scripts online like vscode keeps your settings would be definite solution but even without it you are one git clone away from your repo that contains all customizations. We could have option in Windows to export system settings as PowerShell script.
Its really not that hard, its just that nobody relevant wants to do it.
Microsoft, if you are listening, I would even do it for free (because ultimately it would save me time). Just gimme jurisdiction/authority and we can have that.