If an entity teleports to a different dimension and then teleports a player in the starting dimension to itself, the player will teleport to the original location of the entity in the starting dimension.
For example:
1) as an armor stand in the nether, execute a function from an external datapack
2) in this function, run the following commands in order:
execute in minecraft:overworld run tp @s 0 256 0
tp @a[limit=1] @s
As a player who is selected standing next to the armor stand, you will be teleported to its original location in the nether, NOT its new location at "minecraft:overworld 0 256 0", even though the overworld teleportation should have occurred first
duplicates MC-152997