Here is a similar approach using the command Image > Apply Image
First, set up your Layer Stack with the original Layer on the bottom (Layer 0 in my example). Black Layer above, and add a blank (white) Layer Mask.
Turn off the visibility of Layer 0 as in the image below and click on the Layer Mask (which selects it)
View attachment 145770
Now use the Image > Apply Image command with the following settings. This will directly show the end result via the mask (not yet in the transparency). Note that the source is Layer 0 and Channel is RGB and inverted is selected. The result is place in the Layer Mask as that was selected in the prior step
View attachment 145771
How just right-click on the Layer Mask and choose Apply Layer Mask.
View attachment 145772
With that last step you now have the image with transparency instead of white
View attachment 145773
It's just another approach that does the same thing. The original Layer was preserved as well.
John Wheeler