I believe it's possible if a reserve team is officially registered as a separate club, rather than just being part of the main club's squad.
So from the legal perspective, it's almost like they are independent clubs, but I believe there are caveats that prevent such clubs from getting promoted to the same level of competition as their parent club. That's at least how I understand it.
I believe some leagues would not allow that, e.g. I don't think Premier League clubs would be allowed to have reserve team clubs entering official competition, but they do have separate competitions i.e. Premier League 2 for U21 teams.
I asked AI about this thing and what I got:
Reserve teams are allowed to participate in the Polish Cup (Puchar Polski) primarily due to the tournament's open, inclusive structure, which gives it the famous nickname "The Cup of a Thousand Teams" (Puchar Tysiąca Drużyn).
The Polish Cup is designed as an all-inclusive national knock-out competition. Any club registered under the Polish Football Association (PZPN) is eligible to enter, regardless of what division they play in—from the top-tier Ekstraklasa down to regional lower leagues, reserve teams, and even amateur/veteran sides. Reserve teams begin their journey in the regional qualifying rounds organized by the Voivodeship Football Associations (regional branches of PZPN). If a reserve team wins its regional cup competition, it earns a spot in the main central draw of the national Polish Cup.
Still, I think it's flawed thing and very few countries have reserve teams in cup. I think I save same thing in Finland cup. Though, not sure that there was cases when main and reserve team were drawn into same pair.