Replaced layers gets misaligned, or moved to a wrong position

Unfortunately, Photoshop’s scripting context misjudges a layer’s size and center when it has a substantial premultiplied “empty” area.
Post Manager has a prepared method for this issue, that can potentially fix this when replacing layers :

In other, more complicated cases where even this does not work, you can try to use the Reset Layer transforms Macros before running the Replace Render Elements: