To test if a named group stack is not empty, you should use the name itself inside parentherses:
^(?<bracket>\()?\d+(?(bracket)\))$
^^^^^^^^^
See the .NET regex demo
See the Conditional Matching Based on a Valid Captured Group:
This language element attempts to match one of two patterns depending on whether it has matched a specified capturing group. Its syntax is:
(?( name ) yes | no )
or
(?( number ) yes | no )
where name is the name and number is the number of a capturing group, yes is the expression to match if name or number has a match, and no is the optional expression to match if it does not.
See the C# demo:
var strs = new List<string> { "123", "(1234)", "1", "(33)", "(123", "123)"};
var rx = new Regex(@"^(?<bracket>\()?\d+(?(bracket)\))$");
foreach (var s in strs)
Console.WriteLine($"{s} => {rx.IsMatch(s)}");
Output:
123 => True
(1234) => True
1 => True
(33) => True
(123 => False
123) => False