As far as I can tell, this has been going on for a very long time.
https://community.dynamics.com/gp/f/microsoft-dynamics-gp-forum/156823/sop-entry-duplicate-master-number
https://support.microsoft.com/en-us/help/856311/multiple-customers-have-documents-that-reference-the-same-master-numbe
http://timwappat.info/post/2009/06/19/Duplicate-SOP-Master-number-in-Dynamics-GP
A client called today for help, and I printed out the current 'get next master' code and... it didn't make sense. That doesn't mean it's not right... it just didn't make sense. it was conditionally creating a transaction.
The code below avoids that, and always creates a transaction.
Please... if you you use this, test it carefully and get back to me if it works, or if it doesn't. I'd like to know.