Shouldn't be BaseX block it?
You mean that BaseX should not allow adding multiple resources with the same path? There is indeed one open GitHub issue for that:
https://github.com/BaseXdb/basex/issues/429
One advantage of the current solution is that new documents can be added extremely fast – exactly because of the missing duplicate check. The main challenge of resolving issue 429 will be to ensure that performance won't suffer too much.