Is it often taught that the Fed can only affect the short end of the (Treasury) yield curve, while the long end is governed by investors' inflation expectations. Could the Fed in principle control the long end as well, e.g. by buying long dated Treasuries. Could the Fed in theory set the whole yield curve to zero?
Yes, and they don't need any "unconventional" policy tools to do this, all they need to do is precommit to a future path of short-term nominal interest rates which they will maintain no matter what. The reason that in practice the Fed is unable to control the long end of the yield curve is because the Fed is not an institution which precommits to these kinds of policies - their policy decisions are always contingent on the information available at the date they take the decision, which means bond investors will try to forecast Fed funds rate movements not by looking at what the Fed says they will do in the future, but by forecasting the relevant macroeconomic variables that enter the Fed's decision process and thinking about how the Fed will react to what they expect will happen. Long-term bond yields reflect investors' future short-term nominal interest rate expectations, and by Fisher you may split that into inflation and real interest rates, so inflation expectations are a part of it, but they are not the whole story. Could the Fed set the entire yield curve to zero? Sure, if it could convince investors that it would maintain a zero interest rate policy for 30 years.
If government bonds bear no liquidity premium, then buying up lots of long-term debt and replacing it with short-term reserves will have no effect on long-term bond yields given the short-term nominal interest rate path the Fed intends to follow in the future. If long-term debt is important for some other purpose, for instance to meet some regulatory safety requirements, as collateral in secured lending, etc. then the Fed buying up long-term government bonds may create a shortage of long-term debt, increase the liquidity premium and force long-term bond yields down, but this policy is not optimal. When the Fed tries to reduce long rates, they intend this to have a stimulative effect on the economy today; reducing yields through this kind of mechanism would instead lead to inefficiency a la Friedman's rule.
In practice, a lot of the correlation between QE announcements and bond yield movements comes from what Bernanke called the forward guidance effect: investors interpret QE as a sign of the central bank's commitment to maintain lower policy rates in the future. According to Bernanke, this effect was the primary reason for the "taper tantrum" in 2013, and when the Fed clarified that "tapering" would not mean that the Fed would start raising policy rates sooner, bond yields came back down again.