As far as I know, the only way to self petition for an extraordinary ability (EB1) based immigration, but that probably applies only to a small percentage of H1B workers. The rest are bound to their employer applying to grant the employees immigration benefits, which the employer may or may not do.
I had got married by and had a green card through that before the backlog and what not would have got through on the h1b path, but if I hadn’t met my person I would have still ended up a permanent resident.
Within the EB's, most companies will sponsor H-1B holders for green cards in the EB-2 or EB-3 categories in a 3-step process: PERM, I-140, I-485.
If an H-1B holder wants to get a green card based on work/accomplishments as a self-petitioner, the two main pathways are:
Eb-1A for extraordinary ability, helpful for people subject to long India/China backlogs
Eb-2 NIW, easier than O-1A, takes 2-3 years if you're not subject to India/China backlogs.
But unlike what the top level commenter wrote, the option for an H1B holder to become a permanent resident by their own action, rather then by their employer benevolence, is limited to very few (the green card lottery and the above mentioned narrow self-petition categories), and isn't a thing you can just do after a certain length of stay in the US.
Pragmatically you can already see the effects of anti foreign ethnicity backlash in national politics, so it does seem like something that needs some level of management.