Having done both, I’d say that the primary difference is motivation. Humans learn things to do things. People who learn on their own often have some ultimate goal they are trying to achieve- even if it is I’ll defined.
Learning higher maths and physics is not intrinsically more difficult, but it is hard for most to maintain focus on a topic with only vague applications to anything and leads for most to financial ruin.
Software skills are more common merely by virtue of how applicable they are.
I have also done both and I'm pretty certain higher maths is harder. Its not just motivation. Most people are frightened of leetcode style interviews, which require just an undergraduate level understanding of algorithms. There's plenty of motivation to learn it but most people can't. Higher maths or physics requires way more intellectual horsepower than that.
Maybe the math, but not necessarily the physics. It's a matter of specialization and perseverance. Think of all the thousands of physicists keeping CERN running. These people are smart, know a lot, and have worked a lot of problems, but I'm not sure they're a cut above engineers and/or software devs who have the same depth of experience.
The physicists don't "keep it running ". They have engineers and technicians and so on for that. They come up with models ,design experiments and analyze results of extremely complex phenomena. Almost all of them also have a PhD, they are a lot smarter than your average software team. Okay if you compare them to say people working on compilers at Google , it might be similar, but not to your average team
Consider that there is also an extreme selection bias for who studies higher physics in terms of motivation to study physics vs. desire/need for money.
Given that the income delta between a researcher at CERN and a professional software engineer at Google is >10x I'd be skeptical that this selection always translates to intelligence. Anecdotally, many PhD Physicists transfer into software for monetary reasons and do not come across as intrinsically smarter than the average engineer of equivalent experience.