Things that are worn produce more noise when under load.
Just because you have replaced the sprockets and chain .... Was it done properly with genuine parts? ( lots of fake stuff being sold)
I suggest you check the easy things first.
Are the wheels in line - check with a straight edge and do not rely on the swing arm
Check the chain: Tension, then damaged links. Alignment, remove chainguard and look along chain as you turn the rear wheel.
Rear sprocket check Fixing nuts correct torque, damaged teeth, is the sprocket warped?
Engine sprocket good condition and not loose.
Remove rear wheel and check wheel bearings
Check sprocket carrier bearing.
I can't think of anything else.
A too tight drive chain can ruin the output shaft bearing.
If it's something in the gearbox it is outside of my experience
I believe the lower gears are driven on one shaft and the higher gears on the other shaft and it is possible to have a fault, damage, wear affecting some gears and not others