I got a master's degree in cinema, a few jobs in the industry but I hated the atmosphere there. I still love everything related to arts but at 30, I thought I will go back to what I love: coding (even if I was terrible at it, just a script kiddie with a few personal projects).
After a few trainings, I'm working on ML/AI projects at 33 years old, doing what I love.
I don't regret doing different things during my 20s. All my studies and jobs made me learn so many things, I would not be the same as today if I didn't take this path or If I went studying CS right after high school.
Don't regret doing this only now. You built a family and I'm pretty sure you have learned a lot during your career as lawyer even if you hated it.
It's not a bad thing to have a professional career before programming. I'd imagine that you'll have developed some non-technical skills that some developers lack, to be blunt about it.
On the other hand pages were much smaller, you'd rely on HTML much more than on JS which meant you'd rarely be working with bundlers and such.
But still, if you take the state of the web for what it is, the sheer productivity with today's tools is unparalleled. I think the best time to start coding is tomorrow.
Your second point is also true. But when getting your first job is the hardest part many people would rather do 3 months to a year under someone they wouldnt want to work for and then move to a better role than continue being a waiter or actor for the rest of their career while they hold out for a first job that is ideal.
I agree that persistence is the key but it is easier for some backgrounds than others.
But I already know java fairly well and a few other languages like python as well, maybe its just a matter of making some more side projects and selling myself better.
It takes a bunch of persistence - just keep chugging at applications and learning.
If you don't jibe well with the leetcode interviews (I certainly don't, I just don't do well and I think it has to do with my anxiety), aim for smaller companies or really just any that ends up having a laxer interview process. They do exist though!
I'm convinced the leetcode stuff selects for something largely orthogonal to ability. My major was practically the same as CS, if not harder in many ways (EE) - I can understand any of the concepts in their full math and theory, etc., I generally just don't have them at at my fingertips to perform on demand, aside from basics. This stuff belongs in books to be referenced as needed.
But it wasn't easy. I was working full time in a demanding profession and I'm married with two kids under 5 years old. So basically I spent every free moment I had working on learning HTML/CSS/JavaScript. If my kids were asleep, I was coding. I basically had to burn the candle at both ends to make a career change happen but it's been worth totally worth it.
I got hired to write React but I work for a very small company so we all wear a lot of hats around here. Since I started in June of 2020, I've already learned Java and now I'm working on a new ML/AI project (so Python, here I come).
My only regret is that I didn't do this 10 years earlier.