I'd ask the teacher if she or he has noticed whether your daughter does this during the school day. The teacher won't catch it al lthe time, of course, so it's not a perfect indication, but it sounds possible that this is a bedtime "routine" for her rather than an all-day thing. You're right, it does sound like self-soothing -- same as thumb-sucking for a baby. It also may be related to the lost teeth -- she liked feeling around in the gaps with her fingers and has just started leaving her fingers in her mouth.
It's hard to control what happens at school other than finding ways to talk to her about the results and hoping she understands. Possibly the school counselor can talk to you (not your child, you) and give you some ideas on things to say that could be effective.
For bedtime, of course you can't revert to a pacifier but you could ask the pediatrician and especially the dentist if it would be harmful to give her something safe to chew on at bedtime. There are blankets with attached "chewies" that are actually designed for little kids but she might be OK with that.
It's possible that she's an oral kid. If she continues with this habit especially at school -- and if you find that she wants to suck her fingers or wants to snack all day long at school -- I'd have her evaluated by an occupational therapist who specializes in elementary-aged children. Some kids have a hard-wired need to chew or suck in order to focus their brains; my friend's son is like this and has special arrangements at school to use therapist-approved "chewies" that are safe. He focuses much better and works better and longer when he has these. Not saying this is going to be your child's issue, just that if this habit becomes a constant daytime thing, you might want to look into OT evaluation sooner rather than later. Otherwise, it's a bedtime soothing thing that she needs right now.