I'm 50 and work remotely from rural Japan. I work with a good team and I genuinely like the people I work with. I'll try to respond to each of the points you make in relation to my job:

- I work from home. My wife volunteers most days so I have the place to myself most of the time. However I work in Japan and my colleagues are in the UK, so this means I often work nights. In our small apartment, it's hard to separate myself from what my wife is doing. I try my best to do work where I need to concentrate during the day and then collaborate with people during the evening. It's hard to juggle, though.

- These days lots of companies are doing office work with work at home a few days a week. We do that, but because the company is growing fast, we ran out of desks. This means that people mostly work at home and hot swap when then are in the office. The hot swapping is actually a real sore point with people as they like to have their own space at work, but you can imagine that it's hard for the company to justify having a floor 3/4 empty most of the time. Still, before I moved back to Japan, I did the WFH one or two days a week and IMHO, if you are close to your office this is really ideal -- lots of opportunity to collaborate and lots of opportunity to put your head down. In that kind of environment, personally I'm happy to have open office, hot swap setup. I differ from many people ;-)

- Meetings are a function of company culture. Some companies value them, some do not. I once worked in a company and my manager asked me what I'd like from him (NB: managers, please do this!) I said, I don't ever want to go to a meeting. Can you go to all my meetings and send me a quick email with the result? He said, No problem! (Best manager ever) When you are shopping for jobs, make sure to ask about what kinds of meetings people have and why they have them. I like companies where meetings are for disseminating information to large groups of people. I dislike companies where meetings are for collaboratively coming up with a solution. Other people like the opposite. Know what you want and find a compatible group to work with.

- Incompetent managers. Sorry, no panacea for this one. Most managers are terrible (sorry, but it's truly how I feel). It's a massively hard job, people are not trained for it and often people get into management because they want to bully people into doing what they say. I want a manager who feels their job is to remove obstacles from me so that I can concentrate on work (see point above). 90% of the time I don't get managers like that. It's hard for me to complain too much because I don't want to be a manager, even though I am very opinionated about what managers should do. Again, pre-screen your prospective employers. Specifically ask your potential manager what they think a manager should be doing. I've never met a manager who would lie about that.

- Colleagues: Let me preface this by saying again, I like my current colleagues. As I get older, though, it gets pretty difficult. I'm the oldest person in the IT department at my company. I'm double the age of most of the people (we have a lot of junior people). I remember talking to a colleague about Tenerife because we had both vacationed there. It's an amazing place, but my colleague said that they didn't see any of it because they spent an entire week in night clubs. All of the other people listening to our conversation murmured with great appreciation. The industry is growing rapidly so as you get older you often become a minority. Even though you were there first, it's you that is the "foreigner" in the group (me, especially, LOL). You have to adapt to that culture rather than expecting people to adapt to your culture. For me, that's extremely difficult. Having said that, I have worked in a small startup where nobody was under the age of 35 (and we even had a guy in his 60's) -- I was the baby in that group! There are some founders who want only experienced people and are willing to pay extra money up front to get it. Reach out through your contacts because probably you can find them.

Now, I really like working the way I work (and the day after tomorrow I'm actually going to the UK to meet and greet with the team, which I'm super excited about!) However there are tons of downsides.

- Working remotely for a non-remote team means that there is a definite power differential. People who see each other in person regularly naturally have a better rapport. As a remote person, you're always a bit of an outsider. It's easy for people to forget about including you in discussions (especially if you are in a different time zone!) There are sometimes bad actors in companies too and if someone decides to intentionally lock you out of decisions, there is practically nothing you can do about it. You are at the mercy of others. I spend a lot of my energy trying to keep my relationships working well at work -- tons more than I would need to if I worked in the office. That's why 3 days in 2 days WFH is such a nice setup (and really, I think all companies should do something similar for programmers).

Working remotely and solo is a huge risk. However, if you want to take on that risk, 40 is a really good time to do it. At 50, I've got 15 years left of my career. I need to save for retirement (and I admit to neglecting that in order to traipse around the world doing strange things). I've got savings, but if I was out of work for a year or two, it would be rather bad for me. At 40 (or earlier) you can take that risk a lot more easily because you can then put your head down and do less risky things when you are older if you need to (like me).

Especially since you are relatively young (still 25 years left of work!) and you have no children, you are pretty flexible. Earlier I've been pointing out the need to keep thinking about the work environment when interviewing. If work environment is very important to you, make sure that you value that yourself. Don't take a job for more money that has a worse environment. Maybe there's a jerk that you have to work with, but you can still get your job done acceptably -- don't give up that job. No job is going to be perfect, so make sure you prioritise things appropriately.

If I were you, the strategy I would probably employ (because I'm hugely risk averse) is to find a job with part time WFH that has the option to lead to full time remote. Get a couple of years of experience with working from home (and at least 6 months of full time remote). Then toy with the idea of doing solo consulting (ideally fully remote). As you are learning to work remotely, go to meet ups, etc to make contacts so that you have an avenue for solo consulting. This may mean moving to a fairly large city if you don't already live in one. Try out selling yourself and seeing if you have the character to do that (because not everyone can be successful in that regard, and being solo means you don't have anyone else to lean on). And finally, don't panic. You have lots of time to sort this out. Good for you thinking about it now -- take a few years trying different things and seeing how they work out. But don't procrastinate. This is your time for exploring -- if you wait until you are 50, it gets much scarier (believe me!)