Multiple ways to skin that cat. If you want to fab up a 2x4 support that works, but if you Google up old work ceiling box you’ll see what I mean. Just think about how much weight it’ll be supporting. They are super easy to install. Getting romex over might be the hard part.
In my experience, scabbing in a 2x4 for a light box sucked. Only did it once, then moved to the expanding bar types. If it was strictly for a light light (get it?) I would often just use a round cut in. I think they were rated for 7 lbs.
I’m a retired master, so I’ve done a few. Glad that was all too. Crawling around in insulation pushed me to industrial electric.