As a programmer you will be in the situation many times when you write something that has to be a certain way for reason (like portability) and someone won't see it (possibly a more senior person). That should not feel bad at all, or discouraging; there is no egg on your face!
Or, you might not even write that something yourself; you just understand why it is that way and leave it alone in the refactoring that you are doing; then you get a review comment like "you can get rid of this from here", and you have to respond "no you can't, because ...".