You'll probably be fine if you buy the wheel from the new version of what you have now. Probably. Shimano especially have a reputation for tweaking things just enough that last years parts don't fit.
The real issue is the axle diameter at the centre of the jockey wheel. If that matches the rest is likely to be fine. Unfortunately there's no real way to work this out from online photos or specs, since it's not one of the things that's listed (it only matters to people in your position, no-one else)
If you can find someone with the new derailleur who will let you take it apart to compare jockey wheels that would be ideal. A bike shop is likely to have one in stock that they can do this with, but the labour cost will probably be more than the price difference between the parts and the whole derailleur.
This is another case where if you have the second hand parts handy, try them and see what happens. If you can, it's probably better to scrounge a cheap/free second hand derailleur rather than buying new parts. IME a lot more people break rear derailleurs than wear then out, so it should be relatively easy to find someone who has a broken one with working jockey wheels. I'd try your local bike recycling group if you have one, or a tip shop. Basically, anywhere with a big pile of donated bikes that you can pick through.
If that fails or isn't an option, I'd look very carefully at the cost of replacement jockey wheels that might work compared to the cost of a new derailleur that definitely will work.