Due freezes: weird setup() behaviour on setting up Interrupt and Serial

After long trial and error I found out a solution for my program freezing during setup.

I need to put delayMicroseconds between attachInterrupt and Serial.begin. Without one of the two everything worked. Strangely the second delayMicroseconds is also needed after pinMode

Can anyone explain this behaviour?

void setup(){
  pinMode(beep, OUTPUT);
  pinMode(enc1, INPUT);
  pinMode(enc2, INPUT);
  pinMode(enc3, INPUT);

  digitalWrite(beep, LOW);
  attachInterrupt(enc1, rotaryEncoder, RISING);
   delayMicroseconds(50);  //<- this is needed
  for(int i=0; i<16; i++){
    pinMode(solenoidsTemp[i], OUTPUT);
    digitalWrite(solenoidsTemp[i], LOW);
   delayMicroseconds(50); //<- this is needed
  Serial.setTimeout(100) ;
  beeping(); //setting beep high; delay(50); setting beep low; delay(50)

Certainly! That code will not compile. Variables not declared and no loop function.

Sorry, I left that out because it wasn't the source for the error. The Arduino is getting stuck in the setup() sequence.

It does compile and used to work on random occasions without the delayMicroseconds. I have experience in µC programming and think this might point to an error in the Arduino timer/interrupt handling.