The file naming system has been working as designed and explained in the user manual. You just need to know how it works and overcome this little limitation.
There are 2 options to choose from, AUTO (default) and RESET.
AUTO - the camera will remember the last used highest number and increase by 1 for the next filename until it reach 999,9999. If the card inserted has higher number than the camera, the card's highest number will be used and remembered by the camera.
RESET - the camber will NOT remember the last used highest number, it will start from 100,0001 for a blank card. If the card has files in it, it will used the last highest number from the card and increase by 1 for the next filename until it reached 999,9999.
whichever option you choose, the problem will still occurred if you use the card from another camber that runs the number 999,99xx, though the RESET option will limited the occurrence to that particular card.