I have a MacBook Pro with the exactly same behavior, except for me it is a problem, not the intended feature.
There is a closing lid sensor, a small magnet, that is located near the hinge of the laptop. It detects when the lid is closed and tells the computer to go into sleep mode. My sensor is not working properly and the laptop is not going to sleep mode or clamshell mode when I close the lid.
So there should be a way to physically disable that sensor in order to replicate this behavior.
I have to select "sleep" from the menu, but then it may wake up unexpectedly when in my backpack, draining charge and getting heated.
If I close the lid very slowly at some point before it is closed it turns off the display, but when fully closed, the display would turn back on. I can see the light bleeding. When I try to use it in clamshell mode, the internal display will still be listed in arrangement and I can drag app windows into it, except that I won't see them. So I have to keep the lid slightly open in order for my laptop to go into clamshell mode.
Hope this information can help you.