Motion sensor ground connection won’t work?
I see your problem.
Those aren’t “spares”
This happens all the time as people gain experience.  They come upon a box with more wires than they need, as you have here.  Mentally, they perceive the wires as “The wire I need, plus a bunch of spares”.
What they do not realize is electricians are cheap, and don’t install spare wires.  Every wire has a job to do, it’s just a job unrelated to the novice’s project.    Usually we see this as someone splitting up a neutral group to grab 1 neutral for a smart switch - which breaks neutral for everything. In this case, you did the same thing, but with ground.
Usually novices do this because the instructions require attaching a neutral wire, and they haven’t accumulated the array of “kit” that an experienced person has - scraps of NM cable for pigtails, variety of wire nuts, etc.
In your case, ditto but ground wire.  The grounds you separated need to go back the way you found them. Then, you will need to pigtail off them.
To fix it
Anyway, you are at the horns of a decision to stay with this neutral-less device (that needs ground) or sidestep into a neutral-required device, since you do in fact have neutral here.  Either way:

The switched-hot wire (typ. Red on device, back on cable) going to the lamp will attach to the 1 wire it’s already attached to.
The always-hot wire (typ. Black) will pigtail into a group of black wires, as it probably already does.
The neutral if present will also pigtail, being added to the existing group of neutral wires, so all currently-connected wires are still connected.
The ground if needed will also pigtail, becoming another ground wire, with ALL ground wires connected to each other.

If you connect all the grounds together with your new ground, then your grounding will be restored, and your device will work as intended.
“All grounds always connect to all other grounds” is a rule.  The same is not true for neutral.  Sometimes you find boxes with 2 separate circuits in them.  Neutral cannot cross between different circuits (grounds can).
Bare AND green wire
Now, a few smart switches have both a green and a bare wire.  Read the instructions closely and follow them.  In these cases, typically the bare wire is true ground.   The green wire is a “neutral if possible, otherwise ground”.  These units are designed in a way satisfactory to UL to safely “bootleg neutral” off ground if neutral is not available.  Make sure such a setup is approved by an NRTL; this is the last place you want cheap Cheese junk.