As others are saying, seat time is usually pretty critical. I look at it a bit differently in some ways though.
Confidence comes from taking an action and being certain of the outcome it will produce. The most efficient way I know of to restore confidence is to identify the things we are not certain about and focus on those. If we don't isolate the areas that undermine our focus, and just put in seat time, we may spend a lot of time practicing things that aren't the issue. That's gratifying and may well reinforce falling in love with the activity again, but it doesn't necessarily make a big difference for confidence.
As Reama alluded to, it's very tempting to replay bad outcomes or worry about things that are not happening. This has value when planning, but it's destructive during the activity. To make a random example, if you're approaching a corner and see a patch of sand, you would recognize that the sand is a hazard. In one case, you might be tempted to dedicate a lot of attention to the sand and the possible consequences of riding through it. In another case, you might focus on a line that has no sand, steer the bike towards that, set your line, roll on the throttle and get past the sand. In this case, you have put your attention on the things that lead to a successful and safe outcome. Much more productive.
A first step to regaining confidence faster is clearly isolating the things that make you feel uncertain. Once you know what those are, it becomes possible to give yourself little drills that allow you to practice the skill associated with the situation, get the skill under your control and have many positive experiences where the skill works, you can do it anytime you need to, and know you and the skill are reliable.