Firstly if this is happening a lot, you could consider increasing the timeout to give the reload more time to complete per try.
In answer to your question, add an incrementing count and use that to trigger exit after a certain number of loops, something like this:
int refreshCount = 0;
do {
await Page.ReloadAsync(new PageReloadOptions() { Timeout = 5000 });
refreshCount++;
}
while (!await Page.IsVisibleAsync("input[name='elementname']") && refreshCount < 5)