I can workaround the issue by stopping PowerDevil using
systemctl --user stop plasma-powerdevil.service, and then closing the lid without usingsystemd-inhibitputs 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.