To understand how road numbers ended up the way they did, you need to understand the context in which they were introduced. Originally, A and B roads were going to be just like C roads are today - the council needs to know where they are so it can pinpoint indicents on them, but you don't see them on the signs. It was fairly late in the day that the decision was taken to publish the numbers on MOT Maps and put them
sporadically on fingerposts. I'd be prepared to bet a Brynwich that no signpost for the
A687 (Scotch Corner - Darlington) was ever manufactured. The flagship OS map of the time, the Popular Edition, was still concentrating on showing which roads were the best quality, as opposed to where all the traffic went.
That's how you ended up with all these really short and unnoticeable 4 digit roads that some of us delight in unearthing, like the
A3039 (Axminster), or the A4 ending almost randomly in the middle of Bath by the old Post Office.
Even then, it wasn't really until the early 1930s that the Pre-Warboys direction signs appeared in earnest, at which point, particularly after the A30 got downgraded to the B3400, that local divisional engineers actually noticed where all the road numbers really went, decided a significant amount of it was bonkers (particular scorn was placed on 4 digit A roads like the A3039), got the
1935 Road numbering revision done.
In fact, if you read through the archive files, you really get a sense of the political situation involving some of the numberings - they weren't just fiddling things around on a map! Particularly regarding the very early rerouting of the A1 via Scotch Corner, this wasn't just "getting the route wrong", there was real anger and contempt to the MOT in London from local folk in North Yorkshire about sending the A1 via Northallerton, and a massive storm in a teacup ensued to get it changed.
Regarding the A354 taking over the A37 to Weymouth, I can quote directly from the MOT
On 8th May, 1947, The Engineering (Highways) Division wrote:
With reference to your minute dated 30th April, the alteration in route numbering whereby A.354 was extended to Weymouth and Portland was influenced by considerations of flow of traffic and the desirability of putting these places in more direct contact with London and the home Counties. As will have been seen from the Traffic census returns, comparatively few vehicles join the Dorchester - Weymouth road from the direction of Bristol.
I'd imagine the route of the A417 was chosen in a similar way, at the time, years before the M4 or any bypasses, it probably indicates that in 1935, the best route from Reading to Gloucester was via Pangbourne and Wantage, rather than right through the middle of Newbury, Hungerford and Swindon. Perfect sense when you look at it like that!
tl;dr - Numbering made sense for the circumstances of the time. But circumstances change.