There is none in the way of a transfer. Neither Steam nor GOG will give you a copy of the game in exchange for another platform's copy, nor give you a copy on a competing platform in exchange for theirs.
provided the technical protections measures used by the Game support such transfer
This boils down to if your method of ownership supports it, you can do it. Neither Steam nor GOG support it. A physical disk copy would support it, for instance, so you'd be entirely allowed to transfer ownership of your physical disk copy of the game.
StS2 was being developed in Unity iirc, and they moved to Godot for that new game (and possibly also future games?).