union modifier deletes part of object
It appears you're stretching the limit a bit with the accuracy of the Boolean modifier here. Your two objects have identical height and positions, which confuses the modifier as to which part is in and which is outside the intersection area. 

If absolute mathematical accuracy isn't all too important to you, you can easily solve this by moving the box object a tiny bit on the Z axis - as you already discovered.