The Rambam in the Pirush HaMishna writes that the tefillah of Rav Nechunia Ben Hakana upon entering and exiting the beis midrash is an obligation, not just a story about what he used to do. The proof is that the gemara doesn't ask בכניסתו מה היה אומר, rather מהו אומר, implying that it should be said by all. The tefilla when exiting contains the line:
אני עמל והם עמלים, אני עמל ומקבל שכר והם עמלים ואינם מקבלים שכר, אני רץ והם רצים, אני רץ לחיי העוה"ב והם רצים לבאר שחת
The statement of אני עמל ומקבל שכר והם עמלים ואינם מקבלים שכר means that when studying torah one receives reward not just for what they accomplished, but for their effort and work invested in it. The statement of אני רץ לחיי עוה"ב, Rabbeinu Yona explains that he views himself as if he is always running and the time is passing quickly, he therefore is constantly preparing his way for olam ha'ba. Whereas they don't realize that the end is approaching until it actually arrives, therefore they make no preparations and end up in a be'er shachas.