You are going to have to take the motor apart to get anywhere.
This sounds a lot like it could be loose motor magnets. Bafang fat motors on Sondors bikes in that platform's early days were infamous for this after a couple of years. Some of the motors that came off the Bafang line had magnets that were poorly glued. they still stick hard to the motor casing, but in operation, they make an absolutely godawful grinding racket for a few seconds on startup, going silent once up to a little speed, but may also make noise during operation.
You still hear the noise when not running the motor because the thing is still spinning as you move.
The repair for loose magnets is simple but a pain in the ass. Get the motor apart, number the magnets by hand so they go back together again in exactly the same order (important!) and then slide them out of the core one at a time by hand. re-glue them back into place individually and re-assemble the motor. There are Youtube vids on doing this (I can't find one specific to Bafang motors at the moment although I know they exist). You may find it to be easier just to buy a new motor core and install it.
But first... when you get the motor apart, look at the gears for damage. Getting the motor apart and then back together is pretty easy. You just have to be a little patient so the planetary gears align with the external gear ring so the motor goes back together. And don't get there by forcing it.
I just did a regular re-grease on one of my front motors yesterday afternoon, and took another one apart to examine it that same morning. I took pics of that one. The planetary assembly still in the casing can be popped out pretty easily, and then slid down onto the motor core without difficulty. There may be (probably is) a detachable key to keep the gears indexed. You can see the square slot for it in the axle hole at left on the casing. If its still in place, great. But if its missing find it! You dropped it somewhere on the table or between your feet. They are held in place only with friction. Its a little oblong metal slug. You just have to set it into a depression in the axle and then fit the motor together with that key lined up with the little hole. The pictured motor almost fell back together by itself in 2 seconds. The second motor needed about 5 minutes of jiggering and re-jiggering for the gears to line up and then it slipped back together.
When you get the motor apart, if you find the nylon planetary gear assembly is chewed up you are going to need a replacement. Hopefully the central 'sun' gear will be just fine. Usually the planetaries are softer material and sacrificial.
If you see NO gear issues, my money is on loose motor magnets based on the description.