It always links to /job/$job_name/lastBuild/console. This doesn't work for jobs in folders.
For jobs inside folders it should rather link to /job/$folder/job/$job_name/lastBuild/console.
I've tried to reproduce this issue with Jenkins v.2.138.4 and Folders plugin 6.9.
Since I might have missed something, can you describe in detail how your issue can be reproduced?