The cat-flap was invented by Duke Ercole d’Este in the late fifteenth century. Now they’re everywhere. (The featured image is by Stiopa, shared under Creative Commons Attribution-Share Alike 4.0 International license. )
Cat doors
Cats have lived in semi-feral or domesticated association with mankind for nigh on ten thousand years. Obviously, if they were to keep down mice and rats and other pests, such cats needed independent access to otherwise closed granaries and stores.1 It seems likely, therefore, that the cat doorway, in some shape or form, is almost as ancient as the domestic cat itself. But, sadly, no pre-modern record remains of the deliberate creation of any such entrances to allow cats to get on with their work.
For instance, in The Miller’s Tale, Geoffrey Chaucer (c. 1340s–1400) wrote of an inquisitive servant that
He found a broken panel with a hole
Right at the bottom, useful to the cat
For creeping in; he took a look through that… 2
My point is that, whilst the cat’s use of the hole in the woodwork was evidently encouraged or tolerated, there is no real suggestion that the hole had been deliberately created for the cat’s benefit.
Duke Ercole’s cat-flaps

(Galleria Estense, Modena)
Enter Ercole d’Este (1431-1505), Duke of Ferrara in northern Italy from 1471 until his death. In his youth he was wounded in battle, and thus latterly ‘limped around Ferrara dressed for preference in sober black’.3 He was a renowned and influential patron of the arts, especially of poetry, the theatre and music. It was under his patronage that Ludovico Ariosto (1474-1535) wrote Orlando Furioso.

More importantly, however, ‘he loved his cats, for whom he installed flaps in the heavy wooden doors of the ducal castle’.4 Inexplicably, this crucial cultural innovation is often omitted from Renaissance lists of ‘The Triumphs of our New Age’, which nonetheless include such trivia as the printing press, the compass and gunpowder. Even so, as remarked above, the cat flap is now everywhere. Apparently they are especially popular in the UK, whose citizens are too lazy to get up and open a door to let their cat out.
Sources
Geoffrey Chaucer, The Canterbury Tales, translated into modern English by Nevill Coghill (1951).
Mary Hollingsworth, The Cardinal’s Hat (2005).