@WhiteNoise I found a new argument explaining why this behavior is indeed a bug
If you run the following code
app.fileManager.generateMarkdownLink(app.vault.getAbstractFileByPath('Folder/A.md'), 'Folder/B.md')
you get
[A](A.md)
According to the API documentation, generateMarkdownLink generates a markdown link to the destination Folder/A.md from the source Folder/B.md
However as described in the previous comment, the link leads to the root A.md instead
If we would want to get a link to the root A.md
app.fileManager.generateMarkdownLink(app.vault.getAbstractFileByPath('A.md'), 'Folder/B.md')
we get
[A](../A.md)
which is a valid link to the root A.md
I think, those examples prove that at least the API documentation and the Obsidian link resolution logic are inconsistent.