There are primarily two reasons: competitiveness and corruption.
Competitiveness
You did hit the nail on the head - part of the reason is competitiveness. Public offices compete with private jobs for the same people. In order for public office to be an attractive prospect, the salary needs to be competitive with the kinds of jobs they would be able to hold if they weren't in office.
This seems contradictory: the high salary will not attract "the best", the high salary will attract everyone
Part of this is a misunderstanding: it isn't that a high salary attracts only the best. It will attract many people, but it is required to attract the many of the most talented people. Inadequate candidates will be screened out by the political process: many aren't eligible for office, many more will not receive the support of their party, many will fail to attract enough donors to run an election, and of course many will fail in their primary/caucus/election.
In short: in many cases this salary is appropriate for the kinds of skills that elected officials are expected to have. The pay needs to be this high to lure in these candidates.
Corruption
Having a high salary helps prevent corruption. If that sounds strange, let me introduce you to the fraud triangle.

For our purposes, the important element is pressure. A person commits fraud (or engages in corruption) when they are under financial pressure. By paying a high salary, a person is insulated from financial pressure and the risk of fraud is reduced. Additionally, there is an idea that an elected official should not have other earned income - that could create a conflict of interest while in office. That increases the importance of offering a decent salary.
It isn't that high
It's also important to put that $200,000 salary in perspective. For many executive or professional people, that is not a particularly high salary.
According to the Bureau of Labor Statistics:
- The average CEO makes $185,000 per year.
- The average lawyer makes $136,000 per year.
- The average general manager makes about $120,000.
- The average physician makes about $200,000 per year.
And these are averages. A President or Congress person (and likely state officials) are above average achievers, and likely to be earning more than average in their field.