The attachment of something that's screwed in is not so much the screw, as it is the friction between the material around the screw (the "faying surfaces.")
If you have good friction, and the load/torque isn't higher than the friction, this will work fine.
A drop of super glue can also help this along!
This works with both plastic and metal gears.
Another option includes using the stock horn (injection molded) that come with the servo and screwing the gear into that horn. This is the option used by dedicated robotics servos like Dynamixels, although you can also use this with RC hobby servos and the round horns.
This also works with both plastic and metal gears.
A third option is to laser-cut a hole in the center of your gear (assuming it's made of Delrin or something else that's laser cuttable) with a pattern and diameter that matches the output spline on the servo.
This only works with laser-cuttable plastics. You can use a washer to keep the gear in place axially.
Finally, you can machine the gears with the right kind of spline. Broaching or wire EDM can generate splines of the right dimension. I wouldn't try to cut it on a mill; the micro-sized end mills are still hard to get small enough, deep enough, and oriented enough to cut a good spline of that size.
Pulling up the rear in complexity comes designing your own die cast or injection molding tooling to make the gears matching the spline. Not for those low on cash or time :-)