... the diacetyl was already there before you bottled, and you should have tasted it.
The diacetyl may well not have been there before he bottled. It is quite possible , however, that alpha-acetolactate, the precursor, was. Diacetyl is often formed in the package when acetolactate is non enzymatically oxidized. To prevent this happening you need to either make sure there is absolutely no air in the bottle (impossible) or that there is enough yeast in the bottle to take up the diacetyl that forms.
There is a simple test for acetolactate in beer. Just heat a sample and expose it to air. This accelerates the conversion of acetolactate to diacetyl and, if you have potentially problematical levels of it, you'll smell the diacetyl. You can, in such cases, leave the beer on the yeast longer before bottling or bottle with yeast.