User creation synchronization problem

Imagine a function that allows you to create Vault entities as you wish. Provided to the function includes a username and password. The function should essentially create a Vault entity that is connected to a userpass authentication method user using a Vault entity alias.

The implementation might seem simple enough, but there is a problem when multiple clients perform the same function with the same arguments. If one client succeeds on creating the Vault entity but then fails to create the Vault entity alias, does that client delete the Vault entity it created? What about the other client that is expecting the Vault entity, that was just deleted, to exist?

This might seem more like a design problem rather than a Vault problem, but I was wondering if Vault has some way to solve such a problem.