Your problem sounds familiar. I have three coops, two on the ground and one elevated. I never have this problem with the coops on the ground (well one exception, there are always exceptions) but I always have this with my elevated coop. So far no exceptions to that. I think that is related to roosting as Egghead mentioned.
My brooder-raised chicks normally start to roost around 10 to 12 weeks as long as no adults are present. I have had some start about 5 weeks, my current brood started at 9 weeks, and some go longer, but 10 to 12 weeks is pretty normal. Until they start to roost I think they look for a safe place as low as they can get to spend the night. I normally lock mine in the elevated grow-out coop for about a week when they are 5 weeks old then let them into their run at six weeks. They always put themselves to bed under my pop door the first night. That’s one of the very few things I’ve seen about my chickens that is consistent.
I go down there every night after dark and put them in the coop. I do not consider my run truly predator-proof so I want them locked up at night. Normally they all start putting themselves to bed in the coop by a week of doing this. Last summer I had a group that took over three weeks before they all started going in. Usually a few start but some really resist until the bitter end. After they start going in on their own they sleep in a corner until they start to roost.
Some groups are a lot easier than others. A few years back I had a bunch that did exactly that, all 16 put themselves to bed under the pop door the first night so I tossed them in the coop. The next night I went down there just before dark to do something else and they were all in the pile under that door. But when they saw me coming one got up and went into the coop. The rest followed. After that they all put themselves to bed in the coop whether I was around or not. Sometimes chick TV beats anything on cable, satellite, or antenna. Of course I’ve tried to time that again with later batches but it’s never worked again.
So just be consistent in locking them in the coop at night. They will eventually catch on. When? I don’t know but probably soon.
You mention that they will go into the coop to get a treat. Can you lock the door after they are in even if it is not yet bedtime? Just go down after supper, lure them in, and lock the door. They will be OK since you have food and water inside.
My one exception to the coops on the ground came from a broody-raised brood. She had taken them to the roosts and protected them, but when she weaned them the other adults started picking on them. So they left the roosts and started roosting out of the coop on a storage shelf. That was before I built a juvenile roost in the main coop to give them a safe place to go to get away from the adults. You don’t have that problem.