Sorry, I didn't know against which component I should have filed this bug. The API is just an interface but I don't know how "the database works". I think the API could be smart and simply retry on such occurrences.
The nature of appending something or prepending is that it does not matter when it is done or in which order. So prepend or append text should not throw edit-conflicts. (Yes they do and are not rare: commons:MediaWiki talk:AjaxQuickDelete.js/auto-errors)
T24783: edit conflict while editing the last section of a page