This is my personal recommendation. It is not the best for every single person, and there are plenty of ways to do things, this is just my opinion, which is all I can provide.
First of all - carbs will not inherently make you gain tissue (water is not a tissue), overconsuming energy will. The fact that 2,000 calories a day made you lose weight means you were in a calorie deficit. The fact that you limited carbohydrates did not inherently make you lose weight. This is the first thing to keep in mind.
Secondarily, and perhaps seemingly contradicting what I just wrote, the macronutrient breakdown of whatever daily calorie allotment you have will affect your ability to maintain it. Protein and fat tend to be more satiating than carbohydrates for most (not all), and therefore, maintaining a baseline intake of protein and fat can make sticking to your energy intake easier. Not to mention protein’s role in maintaining muscle mass and the importance of fatty acids for hormone production.
My recommendation is to do what Alex Wild has described on the podcast at length, with some modifications. Set a protein and fat target that you maintain daily. Start out at 1g of protein per lb of bodyweight and about half that in grams of fat. The rest of you daily intake will be carbohydrate. On days where you ride 4 hours, you’ll have to increase your calorie intake. Where will those calories come from? Carbohydrates. On days where you don’t ride at all you will have to reduce calorie intake. Where does the reduction happen? Carbohydrates. Will eating nothing but cereal on rest days make you fat? No, if you don’t eat more than you need. However, will it be more satiating to consume only chicken breast on such a day? Probably. Not saying you have to, just suggesting that it might make it easier to stick to a calorie goal.
This is just a starting point, if you want to adjust, do so. Do you crave more fat? Increase fat. Same goes for protein. If you feel that you need more carbohydrates to perform well in workouts, decrease the fat and/or protein and adjust accordingly. The goal is to feel satiated and happy with your diet.
Additionally, eat whole foods until it becomes logistically impossible. Whole foods are more filling, nutrient dense, and better for you (in my humble opinion). On days where you don’t ride and you calorie goal is 2,000 calories, you will probably find that eggs and oatmeal for breakfast, potatoes, vegetables, and chicken for lunch, and steak, vegetables, and yams for dinner is more filling than cereal for breakfast, a Big Mac for lunch, and pasta with red sauce for dinner. I’m not saying that the second example will make you gain weight if you stick to the calorie goal, only that is will likely be harder to stick to that goal because of more hunger on such a day. On days where you expend 5,000 calories, the first example of a day of eating becomes impractical. This is when you add processed food. If you need to consume 700 grams of carbohydrate on a given day, trying to do it with potatoes and beans will be downright painful. On those days, prioritize whole foods to a point where it is doable, and fill in the gaps with processed stuff. These are the days where cereal and pancakes come in handy. I’m not saying that cereal and pancakes cannot be eaten on rest days, I’m simply suggesting that they may be less filling and therefore make it harder to not overeat on days where expenditure is lower.
Conclusively, I’ll say this. Figure out what your day to day TDEE is without cycling training. Let’s say it’s 2,200 calories. Set a protein and fat target, and keep this intake as constant as possible on all days. On days where you cycle, add the kJ burn to your TDEE, and adjust your calorie target for that day with carbohydrates. Of course sources of carbs have fat and protein too, so be mindful of what food sources you pick. Lastly, eat whole foods until it becomes hard to eat enough, and then add processed foods to hit your daily energy intake target.
Hopefully I’ve added enough caveats to not upset the entire internet. You do you - this is just my recommendation. There are obviously things I’ve forgot to mention. I’m aware that eating potatoes before a ride is a bad idea. I’m aware of the thermic effect of food. I’m aware that calorie intake per day is less important than calorie intake over a full week, and that compensating for calorie burn over longer time horizons is often necessary. There are plenty of things to be said on the topic, I’ve just done my best to summarize what I consider to be most important for getting started. Please don’t kill me