I did exactly that. I have a degree in the arts, but always loved physics and pursued that secondarily. I failed physics because I had taken arts instead of mathematics but found that that didn't stop me learning C and building all the arts programs I ever wanted. Quite some years ago now and I was an outlier but it's not too uncommon.
Good schools are now getting girls into robotics and coding before puberty. That's when you get exited. I loved messing with radios and old VHS players when I was a kid, and probably MOST importantly my father was a technologist: exposure at a young age is everything.