This was an immense help when I recently decided to switch companies. I applied to places I didn't really want to work at so that I could either:
1. Get rejected and get used to hearing/reading those words while not taking it personally.
2. Work on my negotiation skills if I actually got an offer.
Either way it was a win-win for me in terms of what I was really trying to achieve.
You may come across a dream job posting one day and if you can block out the worry of rejection you'll have a higher chance of success.
Up until recently I would take two or three interviews a year at minimum just to see what people were asking about, how they asked, and just to stay comfortable with the process.
Worst case scenario, they say no, and you might get a hint as to why. So now you have an idea of something you can improve on.
Best case scenario you wind up interested in a new company, get a raise, and learn something new.
Either way, it's time you're spending to improve your career- and it is likely more monetarily valuable than the same amount of time you would have spent writing code.
My advice is go on interviews you don't even care about in hopes to get rejected. Some places might tell you to leave like half way through an interview which is awkward, but most will shoot you an email or you just never hear from them.
Once you get a few rejections under your belt, you learn its not a big deal. I've know some incredibly smart people get rejected. Most times you get rejected because its not a culture fit so its for the better.