I believe you are mixing up your
Middle Earth Ages. The first quote you give comes from
The Silmarillion and refers to a time in the
First Age. The second quote is
Gandalf speaking in LOTR (FOTR) at the end of
the Third Age. The friendship that grew up between the
elves of Eregion (founded 750 of the
Second Age by the
Noldor) and the
dwarves of
Moria happened in the Second Age. It was during that time that the doors were built and the inscription placed on them. The inscription on the door states it was drawn by
Celebrimbor, who was killed in the
wars with
Sauron in 1697 of the Second Age. Thus you have 947 years between the coming of the elves to Eregion and Celebrimbor's death. Even if it took 500 years from the elves arrival to flowering of their friendship with the dwarves and the making of the doors, there is plenty of time. And it was the elves writing on the door, not the dwarves.