lol. How do you know you are being 'wallhacked' ?
It's pretty obvious when you spec people. You are correct that there are legit ways of getting a rough idea of where someone is, but speccing a player normally gives it away particularly if they are using a bot also. So the snapshot grenade tells you when you have been identified by it. UAV is not a pinpoint system either and only pings player locations periodically and is not effective against the ghost perk.
In Quake 3 you could demo the player then use the shownormals command to show player locations through walls on the replay. As a server admin back in the day, I caught a lot of players out with that function.
I would like to see that feature in modern games.
With wallhacks - players always trip up when using them and look directly at players through walls and scenery or focus on an area because they know a player is there - ie always being in the right place at the right time, time after time. In core TDM, for example, any player with high kills and really low deaths is suspicious simply due to the nature of the game and the maps. It's just a statistical unlikelyhood that someone can go all map and not die or only die a couple of times whilst also racking up 30+ kills - ie you need to be in the action to get kills like that and map design and game mechanics are such that you have a high likelihood of dying. That's not to say higher kd is always suspicious but 30+ kills but less than 4-5 deaths in core TDM then something is usually wrong unless the player is in a lobby full of noobs.
5 buildings only 1 enemy left - a wallhacker will go to the right building with the enemy in every time. You also never see them get ambushed or run into another player unexpectedly.
Better hackers are smarter and at least try and pretend they dont know where the players are. But theres always some telltale signs. Watching players play a lot gives you spidey senses when you spec someone who is moving strangely, looking at odd things or looking around in an odd way, or ADS in strange places when there doesent seem to be any reason for it. It normally correlates with them destroying the rest of the server too
Bot users give themselves away even easier. Like in the video above.