Steps to reproduce
If inserted text is multilined it could shift selected pmenu item to another one:

In the asciicast you can see that after selecting the second item it inserts contents but selection is shifted to the first(previous) menu item.
Will try to come up with a simple reproducible steps later.
Context: I have added registers completion source for custom autocomplete to be able to complete the whole contents of registers in contrast to CTRL-X CTRL-R that completes only words from registers.
Expected behaviour
Selection in Pmenu should be retained
Version of Vim
9.1.1418
Environment
Debian12, bash
Logs and stack traces