Modifying the core colors like var(--secondary)

If it were me, I’d have the problem you describe because I was changing one color scheme in the UX while using another in my theme component.

Your mileage may vary.