Plugged USB dongle to my Pi3B+ and voila, after reboot (just easier than stop/start services ) remote shows similar problems like you have: Sometimes it works, sometimes not. After stopping Kodi and restarting lirc remote worked always. This is the bad news

The good news is
Setting variable CLAIM_DEVICES="always" in file /etc/default/lirc solves this issue here. I've booted many many times, it never happens that remote did not work after change of this setting