If the developers are listening it seems very simple. Here is the samsung article Samsung DeX | Samsung Developers. It appears the main thing is they must not specifically declare touchscreen support which is a simple couple lines in the manifest.
I also have this issue. It seems the problem is terraria isn't registering itself as properly supported for Samsung dex so dex assumes it doesn't work with mice and therefore treats the mouse as touch.