Working for wages doesn't have to mean 9-5 in an office. Many programmers work remotely with flexible hours. Most places I've worked had flexible hours and in-office requirements even before COVID.
Self-employment can mean selling time and expertise in the form of freelancing. Or it can mean building products you sell. It can lead to a combination of both -- building products and then selling time/expertise to customers. The biggest SAAS companies (think Oracle, Salesforce, etc.) make considerable revenue from services along with licensing their software.
I freelanced for a long time, selling expertise sometimes (not always) measured in time spent. A lot of successful freelancers bill in terms of deliverables, or on regular retainers, rather than charging per hour like a salaried job.
The main value derived from working for an employer, especially early in a career, comes from developing a professional network and accumulating business domain expertise. Building software to sell frequently fails because of poor understanding of the target business domain, which gets wrongly interpreted as a marketing problem. Businesses don't need software or code in the abstract -- they need and pay for solutions to business problems, something that adds value, decreases costs, improved efficiency, yields competitive advantage.