This is definitely what it is.
Why the loop is stopped when the automation re-triggers is (as far as I am concerned) a bug. The second trigger should just be ignored and the loop should continue if the automation is in single mode.
However having said that your automation is not the way to do it.
You should not be waiting in an automation for hours.
Turn the light on with one automation that triggers on your switch turning on.
Turn the light off with another automation that triggers on your bedroom temperature (numeric state trigger) falling below 23, or (state trigger) your switch turning off. So two triggers.
Also you would be wise to stop using device ids. See: Why and how to avoid device_ids in automations and scripts