That's not a glitch. I even say in the instructions for the \nondiscard option that "If the item is in loot, it can still be destroyed." I certainly wouldn't go to the lengths you are asking for and create an alternate system of looting, assumedly by making items that don't fit fall onto the floor and become their own item drops.
One thing that you can do if you want to make sure that can't happen, is go to around line 2664 of the script and see this:
@warning_window.index = 1
@warning_window.active = true
@warning_window.visible = true
@help_window.draw_item_list (@loot)
replace it with
non_discard = false
for place in @loot.placements
non_discard = true if !place.item.discardable?
end
unless non_discard
@warning_window.index = 1
@warning_window.active = true
@warning_window.visible = true
@help_window.draw_item_list (@loot)
end
What that will do is prevent the player from exiting the inventory if a non-discardable item is in loot.