It may be grammatically correct in terms of the time line - that is, the "hopes" may have preceded the "becoming," but logically, absent context, it's unnatural. "We had all hoped that when he became president he would lead us out of this rut," would be more natural. This way, it's more obvious that the hopes came first.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.