I think the problem is that during load, Ruby checks if directory "/usr/lib/ruby/vendor_ruby/2.5.0" exists.
This directory is present at the original docker image, but is missing at a slim one.
According to strace log, ruby attempts syscall and gets
lstat("/usr/lib/ruby/vendor_ruby/2.5.0", {st_mode=S_IFDIR|0755, st_size=6, ...}) = 0
on full image, and
lstat("/usr/lib/ruby/vendor_ruby/2.5.0", 0x7ffd39726850) = -1 ENOENT (No such file or directory)
on a slim one
That is the first difference between application strace startup logs, and I guess that this is the reason why ruby ignores gems for 2.5.0 that are present at the image.
If you choose my bid, I'll explain how did I launch strace in docker container to collect these logs. That should be helpful for you in a long term perspective because the technology is language-agnostic :)