That’s if you had money, of you were broke you’d rent a penny layover and yes that’s where the phrase comes.
You’d literally lay over a rope to sleep and they’d pull the knot loose at a set time in the morning, anyone still on it woke up when they hit the floor.
'Knocker-Upper' in Britain, a method of waking people up for their work shifts before reliable/cheap alarm clocks, 1915 (lemmy.world)