@Op
1, It is assumed that you have chosen Newline option in the 'Line ending tab' of the Serial Monitor (Fig-1) and then you have entered 10000 in the InputBox of the Serial Monitor and then you have clicked on the Send button.

Figure-1: Serial Monitor
2. What do you think about -- what numbers (s) have entered in your Arduino UNO when you have sent 10000 via Serial Monitor?
3. In the Serial Buffer of your UNO, these numbers: 0x31 (49) for 1, 0x30 (48) for 0, 0x30 (48) for 0, 0x30 (48) for 0, and 0x30 (48) have entered into the storage locations of the buffer as conceptually shown in the following figure.

Figure-2: Conceptual view of serial buffer of UART Port
4. You have executed this instruction:
if(Serial.available())
to check if there is any data in the Serial Buffer. There is data in he buffer; so, the MCU will execute your next instruction which is:
incomingByte = Serial.read();
and you have got the content of topmost location, which is 0x31 (3x161 + 1x160 = 48 + 1 = 49). Your led will blink for 49 times due to for() loop.
5. When you have taken out ox31 from the buffer, all the 4 items below it will go up by 1 postion. As a result, the topmost location of the buffer now contains 0x30 (48).
6. because you are under loop() function, the above tasks of Step-4, 5 will be repeated. As a result, the led will blink for another 192 (4x48) times.
7. If you want that the led should blink for 10000 (ten thousand times) and not for 241 (192+49) times, then you have to execute the following codes:
void loop()
{
byte x = Serial.available()
if(x !=0)
{
Serial.readBytesUntil('\n', myArray, 10); //declare myArray as: char myArray [] = "";
}
int y = atoi(myArray); //x contains 10000
//-------blink led for y times
}

