It is not so much about "breaking" a bad habit but more about starting out right, forming good habits.
When a group of pullets enter point of lay, I keep them in the coop. Their pen is large, so it isn't a hardship. I want to watch and see that each pullet "masters" going into the laying box. It only takes a few weeks and they catch on fast. Young pullets sometimes need the laying box to be quite close to the ground, as well. They are also helped by putting some fake eggs or a golf ball or two in the laying box. They get the idea quickly.
I'll let them out in the evening for awhile, even during "boot camp" because most will have laid before 3 pm, if they are going to that day. Once I feel confident that everyone has the laying in the nesting box mastered, they are freed much earlier in the day, but I still watch to see if they go back into the coop to lay. Generally, once they have it down, the answer is yes.