The Speos Artemidos (this is a Greek name, roughly meaning "Grotto of Artemis" (Artemis is a Greek god) is a rock-cut temple dedicated to the goddess Pakhet ("she who scratches"), although other deities appear in inscriptions.
Beni Hasan in Ancient Egypt was used as far back in Pharonic times as the Old Kingdom and continued well after the 18th Dynasty. The site appears to have been mainly used as a cemetery although the Speos Artemidos was not used as this at all. Hatshepsut seems to have used this particular area for something quite different, besides the worship of Pakhet (a local goddess to the Beni Hasan region).
Before Ahmose I, founder of the 18th Dynasty was Pharaoh, Egypt was in its second intermediate period. This is a period in Egyptian history where "foreigners" ruled Lower (Northern) Egypt and local native Egyptian rulers controlled Upper (Southern) Egypt. These foreigners are known to us as the Hyksos.
It is the Hyksos who make this temple so interesting. By the time of Hatshepsut's reign the Hyksos period was a piece of history (since then we had the reigns of Amenhotep I, Thutmose I and Thutmose II. I would suggest that this is like looking back at World War 1, as a very rough timescale.
Since then, Egyptians ruled all of Egypt. We see successful military campaigns, the Valley of the Kings was used for burial for the first time, trading expeditions, rebuilding projects across Egypt and much more.
So what makes Hatshepsut write the following quote in the walls of the Speos Artemidos?
Hear ye, all people and folk as many as they may be, I have done these things through the counsel of my heart. I have not slept forgetfully, (but) I have restored that which had been ruined. I have raised up that which had gone to pieces formerly, since the Asiatics were in the midst of Avaris of the Northland, and vagabonds were in the midst of them, overthrowing that which had been made.From the Speos Artemidos Inscription
Pritchard, James B. ed. Ancient Near Eastern Texts, Princeton, 1969, p. 231
I would suggest a keen sense of her country's history to be the key here. As far as i have seen so far, her father Thutmose I did not refer back to the time of the Hyksos (but am happy to be corrected) so she was not following tradition.
We know from her building work mentioned on the Hatshepsut Project so far that Hatshepsut was a builder of note, commissioning so much in her reign. As far as for her claim to have "raised up that which had gone to pieces formerly" It seems Hatshepsut, as Pharaoh felt it necessary to record the Hyksos in the way she did to highlight her dislike for her country's former history and saying herself as a truly Egyptian ruler she will do what is necessary to stabilize Egypt and to allow it to move on from the past.
For more information i suggest:
Dr Karl Leser - go to Monuments> Speos Artemidos
Wiki on the Hyksos
Anneke Bart - 18th Dynasty family tree
Wiki on Beni Hasan