How buying bonds indirectly from the government prevents the central bank from financing government deficit? From Krugman's macroeconomic textbook (highlighting is mine):

&quot;In an open-market operation the Federal Reserve buys or sells some of
the exist- ing stock of U.S. Treasury bills, normally through a
transaction with commercial banks—banks that mainly make business
loans, as opposed to home loans. The Fed never buys U.S. Treasury
bills directly from the federal government. There’s a good reason
for this: when central banks lend directly to the government, they are
in effect printing money to finance the budget deficit. As we’ll see
later in the book, this can be a route to disastrous levels of
inflation.&quot;

But how does this indirectness prevent the central bank from printing money to finance the budget deficit? If the government can order the central bank to buy its bonds, then it can also order the central bank to buy its bonds indirectly, during its open market operations. I fail to see how this indirectness of buying bonds serves as a safeguard against abuse of of money printing press by the government.
Even though central banks are part of the government they are in most developed countries independent, this is similar to way how courts operate. For example US government has Judicial Branch, where the supreme court justices are part of the government and appointed by president (the same way as chairman of Fed is) but this does not mean government can order supreme court or Fed around. Government could wait for Fed's chairman term to expire and appoint new one but it is expected that these appointees are technocrats and thus its not guaranteed they will act according to party line (i.e. line of the party currently in power).
In principle government could ask ('order') Fed to buy its bonds, however Fed could (and should) say no if it conflict with its dual mandate of price stability and full employment. Or they could say yes if they believe that is consistent with their mandate. This being said as Krugman points out in his book Fed wont go this route in normal times in order to keep it's 'distance' from the government. This really has no economic rationale but rather political one. The more entangled Fed (or any other central bank) gets with the government the more likely it is that there will be pressure for politicization of the institution.
This idea is made explicit by Fed in its FAQ, where it states:

Conducting transactions in the open market, rather than directly with the Treasury, supports the independence of the central bank in the conduct of monetary policy.