Training is also a good idea since bringing a new person to a team has a negative effect on the productivity of the team (#):
(1) If you are not working on a greenfield project, it takes some time for the new hire to get up to speed. During that time, their productivity is negative: They are not really productive yet, and they need help from everyone else on the team.
(2) If you add people to a mature team (or remove people), the team dynamics change completely and the team might need several months to get back to their previous performance again (##).
So, hiring a new developer can cost you several tens of thousands of dollars / euros even after you already hired them. Training your existing developers can make sense here - They get a productivity boost sooner. And, when I teach inhouse-trainings, I always have a feeling that people are more motivated to do their job after the training, even when they cannot immediately use what they have learned: It matters to them that their employer cares about them and their technical excellence.
Still it often makes sense: Some times, you just don't have enough people for your long term plans. But don't expect too much too early.
(#) Adding people to a late software project makes it later / You cannot get a baby in one month by hiring a team of nine women.
(##) I collected some data about this when I was an agile coach for two teams at a large company. We added 2 developers, productivity dropped, needed ~6 months to become reliably higher than before adding the developers. Unfortunately, I cannot share the data. Also, I guess this was an extreme case: Complicated legacy system.