If you can't eventually pierce shields with Hammers then you did not bring enough Hammers. They lose out in terms of penetration so perhaps you should bring Hammers and a high alpha artillery piece to both counter the regen and penetrate at a higher charge level.
Your comparison to artillery approaches some good points but it would be best if you stuck to facts.
Impaler does have the range advantage but overkills a lot against Defender and HLT. It deals 800 damage with Defender at 300 health and HLT at 2475. The 700 metal investment for Impaler is also quite high when you only need two Hammers to rapidly clear a Defender forest. A group of Hammers of similar cost will destroy a HLT much faster than an Impaler will. So Hammer wins or weight and takedown time. Both units have their role.
Pillager is actually quite good against units. It suffers from inaccuracy against thin turrets and is unable to move and fire.
Tremors have 0.25 DPS which is a bit better than Hammer DPS of 0.192 but the difference is not large enough to say that Tremor is awesome vs shields while Hammer is useless. Tremors are unable to focus down a single shield because many shots will miss. They are also a large investment and worse against small turrets. So what is it that makes Tremor much better vs shields? I think you are failing to take the low cost of Hammer into account.
Penetrator has over 3x the reload time of Hammer so it would be hard for one of the units to make the other obsolete. If being bad against units was a problem then Impaler would be useless.
Finally Sniper. Sniper is by far the most worrying unit for Hammer role overlap, especially because they are in the same factory. Hammer has a significant range (840 vs 700, remember, stick to facts!), speed and DPS advantage over Sniper but this is probably not enough. Snipers are very good against a large class of midgame transition units so they pay for themselves in the extra utility. This would be a useful thread if it just stuck to a discussion of the uses and balance of Hammer and Sniper.