Please note that this issue is exclusive to creative mode.
When using the /clear command, items being selected in the inventory are not cleared.
To test this, I used a delayed command block to clear my inventory while I picked up a stack of dirt from my hotbar.
Can confirm, some pretty odd stuff happens when you do this.