@dirs contains nothing until you call the split. Split doesn't iterate the Seq, it creates them. Then the join iterates them the first time and map tries to iterate them again.
my @paths = data();
my @dirs.push: $_.split('/') for @paths; # A : @dirs == [(...).Seq,
say $_.join('/') for @dirs; # C : @dirs == [Seq.new-co
my $depth = @dirs.map(*.elems).min; # D : oops, consumed!
Personally, I think the nicest looking way to fix this is to consume the Seq into an Array (update: though upon consideration, using .cache may be more efficient since it is lazy)
my @dirs.push: [ $_.split('/') ] for @paths;
Calling .perl "fixes" the error because the .perl method automatically calls .cache for you. Else attempting to debug via .perl would consume the Seq which would generally break code. The documentation for Seq mentions this:
Caching is a volatile state exposed to the developer as an optimization. The Seq may become cached by many operations, including calling perl on the Seq (if called prior to a non-cached iteration).