Why different openings are used by computer players? If few best computer players would be playing against themselves, chances of white winning would depend on the opening used. That way after simulating thousands of games the best opening would be found that is strictly better than the others. 
Is there a flaw in this procedure? Has this ever been done before?
You may underestimate the number of games you need to determine the "best" opening by simulation. The differences between different openings are very small and to get a solid statistical judgment a few thousand games for each opening may be insufficient.

Then comes the question of the best response: There is an opponent, after all, and to build an opening book you must test for the strongest responses.

Still, this is all statistical and we know that it is not possible to solve chess computationally at the time being. A deep analysis may find a flaw in the "best" opening that is out of sight for current chess engines.

To your last question: For the chess variant "Schoolbook" (a variant of the Carrera-Capablanca type with rook-knight and bishop-knight compounds) its author Sam Trenholme has started to build an opening book using the method you propose, see http://www.chessvariants.org/index/msdisplay.php?itemid=MSschoolbook (comment at the bottom of the page).