its a common function under Layer->New menu which is in gimp and ps. It create /insert layer on top from visible pixels
Tested this on a relatively complex piece: seems to work fine. (ubuntu 16.04)
testing this on my machine. Looks good to me.
docs added: https://docs.krita.org/Layer_Menu