When you restore from a backup when your PBX dies - or cause you upgraded - or when you fall to LSP and go back to the main, the extension and security code are cached in the phone.
The phone would only flush them if a call server replied with "that's the wrong password!"
Let's say you scale up voicemail to 5 digit and it has a SIP trunk to SM and from SM to each CM.
So, a MWI ON to 21234 is extension 1234 in NY and to 31234 is for extension 1234 in LA, you can handle that as an adaptation or on the inward trunk treatment.
And, on the way out of each CM to voicemail, you could prepend 2 for NY so it sends "from" 21234 and so on.
All to say, you're not the first person to have this problem and I'm sure many people have added a 5th digit to an enterprise dial plan across many systems while still leaving those systems as 4 digit. And then I'm sure a subset of those people did it all over again to add a sixth
Full e164 is nice - if everyone has a DID - and there's little tweaks to let them dial inside their own location in CM as 4 digit too.
What happens when you get your 9th or 10th pbx? Then you have to think about people dialing 9 to get out or dialing 91234. And when they call 91234, CM will always wait for a timeout in case you were dialing 91-234-555-1000. And god forbid any sites have extensions in the 1100s cause people will be calling maybe 311,411,611,911, etc.
It's all in how you plan your design out and what scenarios you expect that design to accommodate. Maybe you'll never outgrow a 5 digit dialplan.
Or maybe a 7 digit dialplan makes sense. Like, 8xx-1234. The 8xx can represent 99 offices/locations/systems (no 811!). Then you have an enterprise rule that noone ever use 8xxx within their 4 digit dials. Either you dialed 9 to go out or 8 on-net or 1-2-3-4-5-6-7 on your switch or within your location. You still want to leave lots of room for anything that uses extensions - VDNs, etc if you're heavy on CC on anything.
Then you gotta figure that if you got to 1 voicemail globally, the PBXs might get there too, so accommodating for what a huge single CM might look like would probably be worth the time to think about now if you're already thinking about how to change the enterprise numbering.
Even if they stay as standalone systems, it'd be better to express a vision of what 'good' looks like in an end-state and how you're going to get there. That's what you can use your SM routing for and put a shim in to tweak to the old 4 digit dial plans for now and deal with renumbering the systems on their next upgrade. That way it's a bandaid you rip off once when you're expecting some turbulence and have project management resources around an upgrade anyway. And the whole point of tossing that little curveball into the PBX upgrades is to adhere to the new enterprise standard of "this is how we route