At least for people in the US, the solution is simple: make internationally-sourced communications opt-in. By default any calls or texts originating from a non-US carrier will be dropped. Then, any spam coming in must be from a US entity, and can be investigated & prosecuted. People who do need to receive internationally-sourced communications can turn it on with their carrier. While they'll still be at risk of receiving spam, the value of sending that spam in the first place will go way down because the vast majority of it will just get dropped. It's an easy solution, and it solves call/text spam for everybody.
I'm reasonably sure that countries like France will sign a treaty to not allow spoofed numbers in this way. They don't want to be a source of scams anyway and so will do their part to prevent them. The details of this matter of course, but France should be an easy automatically opt-in. (I picked France because I can spell it, there are several dozen others that I'm confident can be in the automatic opt-in list as nothing from them is a scam)
I have never once got a spam call from an international number, just local numbers. So your plan doesn't work when some local proxy is happy to take the traffic.
A lot of the time spam calls might look like they're a local number, but they're just manipulating caller ID. Often the actual call can originate anywhere on the planet and look like a local number to you.
Up until very recently, caller ID was stupid easy to spoof if the originating phone company didn't care.
Until recently I would get spam text messages from my own cell phone number. Telecommunication companies are complicit in all of this for allowing phone number spoofing. As long as they make money I guess it's OK for them.