Replacing square flush mount light falling out of ceiling
Replacing that light seems like a solid plan, but I think you still need to repair the sheetrock and put in a standard ceiling electrical box.  The hard part of drywall repair is taping the seams and floating, texturing, etc.  The good news is that you don't need to do any of that.  Do the absolute minimum job of replacing the square of drywall and cut a new hole in the repair for the round ceiling box.  The repair needs to be strong, but it doesn't have to be pretty.

The new fixture will cover the rough repair, but you will still have a standard light installation.