This is a bug and must be patched. Both issues here are bugs, actually. The right thing to do is make it so units can directly attack wall. Below are the reasons why this change must take place (amongst potential others):
1. The wall is no different from any other object in the game. It is the same as a unit except with no "soul". It must be able to be attacked just like anything else. This will make the game more realistic.
2. This is in no way OP - given that there are numerous ways already to stop this from happening. First, the player must scout to find out and see there are walls in the first place. Without scouting, we cannot see and therefore cannot directly attack walls without seeing them first.
3. Herein lies the answer to the second question's missing factor: So what? We can just run up to wall and click to attack it.
No - we can't if opponent uses proper defence techniques. Instead of placing units in front of wall (particularly, speartons with shield bash), they can place all units directly on wall which will make it harder for attacker to select to attack wall as units are blocking. Along with shield bash this will continue to defend attacks albeit much harder than before.
*The wall is meant to delay units from attacking and right now it is bugged in that units cannot attack it to prevent this delay.*
*The wall is not meant to be permanent. If units rush and attack walls and retreat, they can be rebuilt. That is the point.*
Edit - Forgot other important reason: Many units have stun capabilities as well which prevent units from advancing and/or attacking. These can be used to prevent units from reaching wall to attack it.
Ex. Giants, spears have stun+knockback (and respective units in other empires). Combined with many other factors such as magikill electric wall+poison + spears shield bash + giants knockback+stun to knock spears/shadows/swordwrath off statue during rushes, albows, castle archer, etc. this is still counter-able.
Edit - Sorry for coming off as debating in any way. You guys gave great answers!
-----
For example we were just playing and this very situation happened - we couldn't directly attack the miner walls without our spears automatically engaging the other spears. Had we been able to continue directly attacking the miner walls, we could have rushed into the base and attacked and likely taken down there statue. The funny thing is the spears start by attacking the wall but then stop attacking it to engage other units. This needs to be fixed.
Edit:
Here is replay:
www.stickempires.com/play?replay=replay7768752&version=2.22
This opens door for huge abuse of defense waiting until opponent attacks for an easy win. As you can see we would have clearly won or at least come very close - but without being able to fix our attack on the walls even if we defeat all of their units and walls we are decimated and it's back to square one for both but the reality is most if not all of the time the defense will win given that is has castle archer (huge) and is hiding behind walls (huge). Being able to attack the wall makes the game soo much deeper (not to mention realistic).