After further investigations, it seems like that the odd behavior you're describing happens only when multiple read lines are stacked one after the other and executed via Intellij IDEA. Apparently, even regardless of the operating system being used, since you're experiencing this issue on a Mac whereas in my case it occurs on a Windows machine.
I've tested your exact same code on other IDEs too, like Netbeans and Visual Studio Code, ultimately also manually compiled it with javac and executed it via cmd, and none of these cases have shown the same behavior happening on Intellij IDEA.
EDIT
Apparently, as it has been pointed out in the comments, this is indeed an issue of Intellij IDEA version 2022.1.1. The link below also says that it will be fixed with the version 2022.1.2.
https://youtrack.jetbrains.com/issue/IDEA-293951/Console-readLine-skips-input-in-2022-1-1
So, to answer your question this is not a problem with the code you've written but rather an issue with the IDE you're using.