I think that scrapping the ww1 battleships and building new ones, even if it were possible (I don't have specific knowledge on Italian interwar shipbuilding capabilities) would not have solved Italy's problems.
The worst was of strategic nature:Italy depended from imports of oil to keep its navy going, after the start of the war it had to move very conservatively to avoid using up all its fuel too fast.
The other problems are tactical and may be easier to solve: eg better coordination between naval and aerial forces and training for night actions might have avoided some of the defeats the Regia Marina suffered. Maybe it could have been possible to introduce the Radar, but I am not sure if italy could do that.
In any case it could never outproduce the UK, it was simply a war Italy could not win and shouldn't have entered in the first place.