I don’t think it’s a bug - it’s just a consequence of “layout” of your template, and the way you “break” it by inserting the hook container later.
The dummy item (#3 in your template) is scheduled “soft” at 00:30:00. That means that the scheduler picks just over 30 minutes of music for block 1, then adds the dummy.
In your example, the length of music block 1 was 00:33:10 (I’m following that from the start time and duration of item #12: 00:29:36 + 3:34).
The end of hour jingle is scheduled at 00:59:54, so the target duration for music block 2 is 00:59:54 - 00:33:10 = 00:26:44 - so the scheduler picks a set of songs that are just over 26:44 long in total - but possibly longer than that, our example 00:28:34 (again I can tell that from the start time of the first song in the block: 00:31:20).
So you ended up with two blocks: 00:33:10 and 00:28:34 - which is obviously much longer than the target length of 00:59:54. The “backtimed” flags of block 2 propagate the fixed time of the end of hour to the beginning of the block. This makes the block “overlap” in the middle of the hour, and “eat up” your dummy jingle in between.
(Thumb rule: Normal timing makes the last song being cut off; backtimed timing makes the first song cut the item before it.)
When you look at the playlist in the DB editor, you can just see that effect: Block 1 and block 2 are played in full, but the dummy is not played at all because it is capped by the first song of block 2.
Now what happend when your script inserted the hook container?
All songs of block 1 started about 30 seconds later than scheduled. And also ended 30 seconds later. In particular, “We Belong” now ends just after 00:30:00 - this is when the soft fixed time of the dummy kicks in, now skipping the last song of block 1!
But as the dummy is now playing much earlier than expected, at 00:30:07, the remaining duration 00:28:34 of block #2 is too short to fill the rest of the hour, and you receive the underrun warning.
I think you should reconsider your template. The soft fixed time of the dummy in the middle doesn’t make much sense to me.
At least add a dummy of length 00:00:30 before the first music block to account for the hook container.