How do you know that these seven were not elders? The word “deacon” does not appear in this passage.
The word deacon is not present although the root word is. Note that the twelve say that they should not neglect the word of God in order to serve tables. (Acts 6:2) The word “to serve tables” is διακονεῖν from which our word deacon is taken; see here. Note as well the occurrence of the noun form of the same root.
Now at this time while the disciples were increasing, a complaint arose on the part of the Hellenistic Jews against the native Hebrews, because their widows were being overlooked in the daily serving διακονία. (Acts 6:1)
“But we will devote ourselves to prayer and to the ministry διακονία of the word.” (Acts 6:4)
Lightfoot comments further:
The functions [given in Acts 6] moreover are substantially those which devolved on the deacons of the earliest ages, and which still in theory, though not altogether in practice, form the primary duties of the office. Again, it seems clear from the emphasis with which St Luke dwells on the new institution, that he looks on the establishment of this office, not as an isolated incident, but as the initiation of a new order of things in the Church. It is in short one of those representative facts, of which the earlier part of his narrative is almost wholly made up. Lastly, the tradition of the identity of the two offices has been unanimous from the earliest times. Irenæus, the first writer who alludes to the appointment of the Seven, distinctly holds them to have been deacons. The Roman Church some centuries later, though the presbytery had largely increased meanwhile, still restricted the number of deacons to seven, thus preserving the memory of the first institution of this office. And in like manner a canon of the Council of Neocæsarea (315ad) enacted that there should be no more than seven deacons in any city however great, alleging the apostolic model. This rule, it is true, was only partially observed; but the tradition was at all events so far respected, that the creation of an order of subdeacons was found necessary in order to remedy the inconvenience arising from the limitation. source
Mosheim disagrees because he thinks the young men who carried out Ananias and Sapphira were deacons. source
It appears then that the office of deacon was instituted before the office of elder.
Not quite. The office of elder was already in existence. Note that when Paul and Barnabas made their relief visit to Jerusalem, they were sent to the elders of the church in Jerusalem.
And in the proportion that any of the disciples had means, each of them determined to send a contribution for the relief of the brethren living in Judea. And this they did, sending it in charge of Barnabas and Saul to the elders. (Acts 11:29-30)