I've made the same connection for rope lighting.I don't see a problem with it .Although some may disagree and cite a code infraction.But, the cosmetic part with a box and recetacle is most times unacceptable to the owner.I refused one time to install the cord end in such a manner.Later I discover that the GC had drilled a hole in the lvl and ran the cord inside the attic and plugged the rope light in.
I would inform that GC that if he did that with my wiring I would make it a point to show it to the inspector and explain that I did not do it.
You know, we spend enough time learning our trade, I get a little irate when a stupid framer decides he knows better than I do about my job. I've been down that road, never again. People are paying me full price, there's no excuse for them getting DIY quality wiring.