Attaching curtain rail to plasterboard/drywall over studwork
Typically you attach the curtain hardware into the stud framing around the window, the only reason to add any extra wood to mount the brackets is if you need to move the bracket out from the wall to get clear of any window trim, or if the hardware must be installed somewhere that doesn't have any studs behind it and you use the wood piece to span the space between the studs.

You can set the hardware directly on the plaster, or some installs may have it on the trim surrounding the window, but either way, you want a long screw that can reach and hold into the stud to avoid the curtains pulling out the old hardware.