I'm convinced that pyramids were built more as bunkers than as tombs. Sure they were used as such, but consider their features and utility.
High-ground gives archers range, and long line of sight. Horses couldn't traverse the steep surfaces, and foot solders would have to fight uphill. Traps and secret passages make navigation a daunting task. Stone construction prevents arson and render any sort of siege weapons useless. Food and novelties ensure a long stay is possible.
Rulers of these ancient cultures often had invading armies and their own subjects to to hide from. Pyramids seem like the most practical solution to this problem.
You seem to be mixing up the time period. The pyramids are what like 3000 BC? My ancient history is pretty shit, but IIRC seige weapons first started with archimedes and the Greeks in like 500 bc. It might just be me, but it sounds like you're referring to more medieval sort of weaponry.
I may be totally wrong, but I can't recall any thing that would properly fall into that category.
Wait I have an idea..
Summoning @lockeproposal