It wouldn’t be hard to build.
You’d need a decent sized 9V battery, a loud 9V Siren, and a microswitch. Maybe a 555 timer so the siren will time-out if the micro-switch remains closed. The circuit should be pretty easy to build.
Of course, you’d need to live in a bunch of units (flats, townhouses, apartments, etc.), you would need the co-operation of your caretaker, and you would need just the right sort of letter boxes.
To start with, your letter boxes should be fairly distant from the nearest bedroom. Flats often have a grid of letter-boxes. Often they are over-provisioned; there’s room for a spare letter box or two.
Install a fake letter box with a non-existent flat number. Install the circuit inside the letter box, and arrange the microswitch to close the circuit if anything is inserted in the letterbox. Lock the letterbox shut.
Then put a prominent “Addressed mail only, please!” sticker on the front, and give those tree-killing, polite-sign-ignoring, letter-box gumming, letting-thieves-know-you’re-on-holiday, leaflet-spamming bastards a rude shock.
Yes, as it happens, I am a bit grumpy today. So what?! You want to make something of it!