Yeah I always see this expressed as a criticism, like "oh these small companies just hate junior devs! Everyone wants to hire a senior dev, no one wants to hire a junior dev and train them!"
But it's not always that easy. If you're a small company still looking for product-market fit or doing a fair bit of greenfield development, there's just not much work for a junior dev to do. These companies aren't all stupid or lazy or discriminating against new grads for some reason.
It's the same reason estimates are hard - we're building brand new things that we've never built before and a lot of the work is in the design. Junior devs need to be told what to do. The architects/senior devs become a huge bottleneck because they can only design so much stuff at once, so until you can find more of them you can't hire more junior devs because there's not going to be anything for them to do. Until you get to a point where you're doing repeatable work or your design/architecture is solidified enough to keep people on the guard rails, there's just not a ton of work for a junior dev to do.
Finally, you also have the issue that a lot of devs don't want to get into any kind of management but they want to be managed by technical people. You end up with a shortage of decent managers (where "decent" means both someone who's ok at the job of management and is acceptable to the team).
If we had more work to give to junior devs we'd happily hire them - they are so much cheaper!
And one other contributing factor is a lack of unions. Say what you will about seniority-based comp/perks, they do make people stay in one job for longer, which makes it more worthwhile to invest in a junior dev.