I don5 see why this is such a problem, in software terms.
Assuming the database holds all the waypoints - including duplicates - it would seem simple to have the software select the one closest to the next waypoint in the flight plan. If those that exist are all so far apart I can’t see a flight plan where there won’t be multiple other waypoints between the two instances.
They must do something similar to identify which of the duplicates to use even when the identifier only appears once in a flight plan.