I think a combination of factors:
1) In face of a crisis the government needs to do something - anything. Saying "this is a complex problem and our understanding of the behavior of viruses is far from complete" is not going to do it. People want simple solutions which are easily sold by sloganeering. Masks were a simple answer.
2) I believe only a handful of the top realize they are bullshit, and those few likely hopped on board because they expected the virus to subside whether we were told to wear masks or we were told to wear an onion our belt - they could take credit for the talisman.
3) They miscalculated that mass PCR testing would continue to show the virus as endemic. Considering this is the first time we ever mass tested a population for PCR, they had no way of knowing that in fact shit tons of people would continue to trigger PCR tests (I also think the few who realized masks were just a talisman aren't fully aware of how prevalence, sensitivity, and specificity work)
4) Now they are stuck with this as accepted fact. Politicians aren't going to turn around admit they were wrong, or that the science isn't settled. They have to pretend. This may go on 6 months, 6 years, 6 decades. Who know. We have done a lot dumber shit and stuck to it a lot longer than we should have (looking at you, reefer madness, war on <insert anything>, pretending Cardi B has talent)
5) Trump said he didn't think masks were a good idea so obviously they must be the solution. Like when he suggested the cure shouldn't be worse than the disease we tossed the hippocratic oath.