I will share my setup that is a little different from the accepted answer - although it is inspired by the accepted answer. Hopefully it can help anyone who has transparent gradients in the images they want to layer, or who wants to layer numerous image textures repeatedly.
Here is the node setup:

And here is what's happening inside the "Alpha Over" Group node:
Having the alpha set to "straight" caused problems for me, so I can't overstate the importance of setting alpha to "premultiplied".
The Group node is pretty simple inside. Just like the method in the accepted answer, the alpha gets summed (think of a silhouette - the order doesn't matter). For the color Mix node however, it is the over image whose alpha channel drives the factor.
These Group nodes can be chained as many times as needed. If you want to change the blend mode for one of the mixes, duplicate the Group node and click the number indicating how many users the data-block has. This way you won't be changing the original group.
Update
2023-03-09
I thought it would be convenient to have opacity sliders for both "layers" built into the Group node, so I have added those.

Note: Readers can disregard the "IAP_SHADELESS" group, as it is not relevant to the opacity setup.
Inside the new and improved "Alpha Over" Group node:

Just like before, the alpha from the "over" image is factoring the Mix node. But now, it first passes through a Float type Mix node in order to account for any opacity slider adjustments. This ensures the opacity will be correct, regardless of the Blend Mode being used.
Here is a demo .blend file for anyone who wants to inspect the setup, or even append it to their startup file.

Made with Blender ver. 3.4