The following does not directly answer how to add or preserve comments, but it might get you toward the goal of knowing which transform was used. Admittedly, it feels a little strange, so keep your eyes open for other answers. It's just the first thing that came to mind.
I don't know of a way to preserve the comments from transforms, but you could always insert a dummy application setting to deliver the information. The app doesn't actually have to use it for anything =p
Here I have it being inserted by the transform, assuming it isn't in the main web.config. You could just as easily do a Replace.
<appSettings>
<add key="WhichTransformWasUsed" value="Production" xdt:Transform="Insert"/>
</appSettings>