I think this flashback was actually pretty well done. His life was flashing before his eyes and he ended up remembering something he thought was pretty insignificant that could save his life now. Since the process of "your life flashing before your eyes" is theorized to be a survival instinct to try and rapidly find a solution to prevent your death, even memories you thought you forgot may come back. Only thing that's pretty wack is how there was specifically a time where he got to interact with mud in such a way that would benefit him now.