Another solution is probably to actually install TK2D.
And another solution is to open Edit>Project Settings...>Player...
And then remove the TK2D defines under "Scripting Define Symbols*"
But I assume you're right, this would happen if it fails to compile because TK2D isn't there.
I guess we at least need to document this.
We'll consider options to mitigate this inconvenience.
Thanks for reporting!
spine-tk2D without 2D Toolkit quirk