As an American English speaker, all four examples seem correct.

The past perfect often seems to be used in American English to avoid confusion about the relationship between two past events. Where such confusion is impossible, the simple past is often used.

"I had typed ten pages when he returned." indicates typing before returning. "I typed ten pages when he returned." implies that returning is simultaneous or even before the typing.

In your examples, "by the time" serves this temporal ordering purpose, so the choice of verb tense is unnecessary.