Keep programs running while in sleep mode?

I can workaround the issue by stopping PowerDevil using systemctl --user stop plasma-powerdevil.service, and then closing the lid without using systemd-inhibit puts the computer to sleep, while doing so while systemd-inhibit is running (as per the above command) correctly prevents the computer from sleeping.

That is a GREAT analysis!
I also identify problems with powerdevil, but for me it is the dimming of the screen.
Might be powerdevil is not entirely correctly coded when making calls.