Create your own .exe file for launching the game. You will have to be knowledgeable in C/C++ and the Windows API (if you are building for Windows). See instructions in the manual (check each page in that section).
By creating your own code for the .exe file, you could potentially do anything conceivable in C/C++, like performing offline checks, making sure the files present are really only the demo files, obfuscating/encrypting your data, etc.
Your game can still be cracked in the usual ways that any C/C++ application could be cracked (and if you go deep into this it will be a game of cat-and-mouse between you and the pirates, even the stuff I mentioned are easily beaten by any competent cracker), but it should be easy to prevent that simple method you've explained.
Note: The reason why Steam doesn't detect a change when you replace the executable is because the .exe file of any Windows Standalone build is all the same (if they are from the same Unity version at least), doesn't matter what project it was built from (you can verify this by doing md5/sha checksum of the .exe file of any Unity Windows standalone build).
In this way, as far as Steam is concerned, the .exe file of a demo version looks the same as the .exe file of the full version, because the binary data inside them is the same.
When you build a Unity project, this .exe file is just copied over and renamed to whatever you specified. The job of this .exe file is to simply launch the Unity engine.
The WinMain function of that .exe file is extremely simple, it just calls a function called UnityMain
. UnityMain
is within the UnityPlayer.dll
file (you can find that dll in the same folder that the .exe file is in). That's the Unity engine (Windows version) C/C++ source code compiled as a dll (and it's closed source). It's the starting point of the Unity engine in Windows (the other Unity dll files you can find in the build are C# stuff).
Explaining all that is pretty off-topic but my point is that the .exe file does nothing more than launch Unity. It doesn't care what game data is given to it.
Unity provides you the source code and Visual Studio solution of the .exe file in:
wherever you installed Unity/Editor/Data/PlaybackEngines/WindowsStandaloneSupport/Source/WindowsPlayer
You could use that Visual Studio solution as a starting point when making your own .exe file.