The postman was undoubtedly extremely out of order and OP was absolutely NBU. Aside from being phenomenally rude and unprofessional, it's also a form of 'crying wolf', I'd say - as you'd expect somebody beating at your door and shouting that they know you're there to be alerting you to a fire billowing from your house and reassuring you that they've come to your rescue. It's an extraordinarily inappropriate thing to do when you're just there with a parcel: like the equivalent of shouting "FIRE!!!" in a restaurant rather than waiting to catch the waiter's eye to ask for the bill.
Of course, as has been said, as well as potentially being the actions of a rescuer come to save your life, the only other rational explanation would be that it's an aggressor wishing to do you harm.
As for those (who didn't read the OP) saying how irresponsible it is to order parcels and then not be in, Royal Mail don't give you any timings, even if you are expecting a parcel.
Even the likes of Amazon, who are probably among the best at giving you the ETA of a parcel, will often quote a delivery day and then change it. It's great if you're in and available and unexpectedly get 'Friday's' promised parcel early on Tuesday, but if you aren't in (or are in a meeting, or bathing a baby, or having a wee, or TTC, or on an errand....) and specifically made plans around being in to receive it on Friday, as was originally confirmed, it's not actually a lot of help at all.
As for all of the suggestions to leave a note, one thing I've found is that many (I'm sure not all) delivery people either cannot or do not bother to read them, and do their own thing anyway. We have a prominent parcel safe (labelled 'Parcel Safe') on the wall, right next to the front door, with a lock on it and simple instructions printed on it. More than 95% of the time, it gets: ignored: used but not locked (not really a problem unless we're on holiday) tbf; used for normal letters when there's a letter box right in front of them; locked without anything being put in it, and then the parcel left on the doorstep etc.
So many delivery people seem to expect you to be on sentry duty behind your door at all times, with your hand on the door knob; and honestly appear baffled if it takes anybody 20 seconds or so to come to the door. Many of them don't wait for any length of time at all, so after disturbing and summoning you, they're long gone anyway.
If anything, we have the opposite issue to creepy, grossly inappropriate postmen shouting that they know you're there: ours will sometimes ring the bell or knock, wait a short time, and then - when your shadow is clearly looming behind the (glass-panelled) door and they can hear the sounds of keys jangling (even if you've already shouted "I'll be there in a moment") - they still hammer at the door.
I often wonder if some of them genuinely think that all householders are factory-fitted with turbo-accelerators that are somehow remotely triggered by the sound of a door being hammered down - surely there's no other reason why anybody would continually bash on a door that they know somebody is visibly in the process of opening for them?