You made out very lucky, I am not sure I've saw that happen before without oil pouring out the pto shaft hole.
If you are using an extendable pto shaft, it may be a bit too long and is not able to compress with implement movement.
Looks like it was time for a fluid change as well, so that's a bonus. Sucks having to open a case just after a change and replacing the oil again.
Why would you feel you would have to change out new oil just because you wanted to open the top of the case? I am putting in new oil because it does need changing, but if it was new I would leave it in or save it if I did have to drain the bottom (for instance to find a broken circlip).