Coding doesn't need to be an absolute expert on math or law 99% of the time. We can make it have worse loss on those subjects to improve it on coding. If we do need some legal knowledge while coding it can reach out to a different model that specialize in legal knowledge to figure it out.
There are design choices that improve general intelligence and coding capabilities simultaneously (for example, training a bigger model). There are also design choices that trade off the two against each other (for example, changing the data mix). Currently, there are no incentives to make a model that's so specialized for coding that it completely underperforms on general intelligence evaluations, but if the labs wanted to, they could.
The market appears to disagree.
The biggest most profitable AI market segment (coding) is all about general intelligence.