Well, I don't like to speak in absolutes on this one.
One rule to know is that the outer edge of the box cannot be more than an eighth of an inch back from the surface of the plaster/drywall/whathave you.
The boxes you show at the bottom are for masonry, but I don't think I'd much care about that.
The ring you show will support most medium and small light fixtures, so I'd be OK with it.
Is the light all made of metal, especially that which shoves up against the ceiling? I've never seen one that was not, but you never know.
Really, the purpose of the code in this area is that the wires and especially the joins in the wires all be contained in non-flammable material. Steel is a good choice! Wall board is hard to light on fire.
As long as any potential arcing in the box is not going to send sparks onto timber, you pretty much are doing the right thing.
But me? I'd prefer a large box with the correct mud ring. Unless the wires are very old with brittle insulation, you should be able to manage the business of making the connections and then shoving the whole lot back up into the box.