I am not a contractor, and this is a real do it yourself type approach. This is provided at your own risk, and I assume no liability for damage.
The only thing I can think of that is going to auto reset in the way you've described is a device powered by gravity. Everything else ( anti-kick devices installed backwards, anti slam devices) either won't allow the door to close or need to be manually reset.
I picture a small piece of plate steel rather than wood, for durability, that has a hole bored in it, along the top edge, perhaps in the center, perhaps 1/4" - 1/2".
Through this hole pass a bolt whose body is less than the hole size, but whose head is too large to pass through (you'll likely end up with 1/16" or 1/8" clearance on the inside of the hole, which should be fine. You'd want to use a bolt that is threaded right to the head as opposed to those that are only partly threaded. You might need to scratch your head a little to get the bolt length right, but I'm thinking that a 5" bolt with 1" into the wall might be enough (remember that at the corner of the door the gap will be much more than 4").
You will also require a self locking nut for this bolt, some washers and some sort of threaded hole you can install into your door frame (there are hammer in threads available, just make sure you plan ahead size wise, some people would just hammer in a nut).
To support this contraption, I picture a wire back to the wall, but a firm brace like a piece of rod or wood could also be used. The brace should look like an upside down triangle when it's installed.
Drill a hole in the top of your door frame, within an easy reach of the door handle (you'll need to reach it to get out of the room), and install the threading. Make sure that you leave enough room for the plate to swing upside down and still clear the door.
Place the loop of wire/support rod on the bolt next to the head.
Place a washer on the bolt and pass it through the plate. Place a washer on the bolt (so that the washers are sandwiching the plate) and put the nut onto the bolt, so that the washers and plate are close, but not firm (if it's too firm, it's too hard to swing it out of your way).
If the door blows closed, the nut will prevent the plate from sliding back to the door frame and thus striking your pet.
When you want to open the door, you swing it open (the plate is between the door and the jam).
When you DON'T want the door to close, do nothing, (the plate's in the way) and gravity will reset the material.
When you DO want to close the door, swing the piece of material out of the way and close the door. When you want to get back out, you'll have to push the plate out of the way again, and leave, gravity resets.
Ok so that's really a lot of text, but it's a diy description ...
I personally think it's easier to use an anti-slam device and put it somewhere remarkably annoying so you can't forget it. Something like this, put over your sink faucet while you use the washroom. They come in really big foam finger style designs, that would probably help give your pet time to get out of the way or prevent some injury.
Best Answer
See the lock insides? That's a metal sleeve, with an inside sliding piece. That inside sliding piece is connected to the latch bolt. Push it to the left, and voila!
Some additional details. This is what you see when you remove the knobs, shaft and escutcheons from a knob set. The central shaft, which is has a flat, vertical cross-section, goes through that D-shaped hole. Turn a knob either way, and the top or bottom edge of the bar pushes against that sliding piece to open the latch. (Hence bib's suggestion of using a large screwdriver to act as that shaft.)
I believe the smaller hole on the right is for a lock. Push a button on the (interior?) escutcheon and a round shaft is pushed into that hole, preventing the sliding piece from sliding. Low-tech, but quite functional.