WordPress dominance of the web has certainly peaked, but history indicates there will be several years in which to continue to extract comfortable profits while riding it down. e.g. Oracle, a database that almost no business has actually needed in decades.
I'm not convinced that sort of legacy lock in exists in the web space. It moves fast and its value is in the content. In the age of AI, migrating that data makes it trivial to move away from a risky platform. I cut my development teeth on WP and managed some fairly large sites. There are far more interesting and well developed alternatives out there.