Making changes like that is best for a child theme so that you can get updates to the parent theme without losing your changes. Basically you would copy the header.php into the child theme then make your changes there.
There’s a few ways you can do this, but if you want to do it the way you just did, then you would need to do it this way:
If you wanted full control via css, then in the child theme’s style.css, you would do your background styling there and remove the background colour line (which means the theme setting for this would be removed).
Then do your background styling as a class as mybackground