With the Windows 10 Game Bar, you can record the last several seconds or minutes of screen activity after you've already performed it.
First grant permission for the computer to record your activities in the background.
Open the Game Bar and click the Settings icon. Scroll down the Settings screen and check the box to Record in the background while I'm playing a game.
Click the drop-down menu for Record the last and change the interval to anywhere from 15 seconds to 10 minutes.