Worked more on the forum UI and reached a breakthrough.
Although not documented yet, a new feature has been added that allows setting all UI color variables directly from the theme’s about.json.
Previously discourse only allowed a number of colors to be set by color schemes and rest of the colors were created using sass functions that in our case resulted in undesired colors in the UI.
So now instead of finding and replacing colors one by one, we can directly define all colors in the theme.