Hm that's clever. You're basically taking the classic "queue using two stacks" algorithm but then replacing each stack with a min-stack (like in that leetcode problem where each element also tracks the aggregate of all elements below it) to get a "min queue".
And then unlike the usual monotone queue for sliding max/min, this works for any monoid since you're never comparing two elements.