I thought when you not running for a while, your fitness level or stamina will dropped
Complicated.
In training for race (not health or fitness) there are mainly three metrics to monitor closely until race day. Every trainer program has their own names or label for these 3 metrics. I am familiar with Elevated Strava (ES) naming of these metrics. ES called them
Fitness,
Fatigue and
Form.
You maintain consistency with adding Load with trainings, ES will plot a graph showing your Fitness improving as you add on the training load. However as Load is add on, Your Fatigue number will go up and your Form will go down. There're are some numbers that you should not allow your Form to go below, and if it happen you risk Burn out and Injuries. So you give yourself some days to rest or do recovery run, to improve your Form. But this will be at an expense of your Fitness.
Then comes the tapering prior to race in a Periodizing model. At this block of the your goal now is to improve your Form with reduction of Load hence reduce Fatigue. But the unwanted side effect is reduction of Fitness. Bo pian, on Race day, Form is important, cause fatigue can mess your performance even if your Fitness is at it's highest. The key on a good well planned tapering is to improve your form with a minimum impact on your fitness. Not easy, that's why even to the day prior, there will be some shake up runs or easy run to not let the fitness go down too low, while not impacting the form as much as possible.
If I am making sense at all, what OP was experiencing is a good rest gave him good Form, he performed better compare to while he was training. But that doesn't necessary means he is fitter, coz cumulative fatigue may drag down performance even when the fitness is high.
Garmin and Coros has their own version of these three metrics, I don't know what's their name. I look at Coros, I still can't figure out, coz their numbers has more meaning than the simplified ones from ES.