Is the Pakistan Army stuck in a position where they must obey the
No. The Pakistani Army thwarted U.S. policy goals regularly during the U.S. participation in the war in Afghanistan, effectively sheltering U.S. adversaries on Pakistan's territory or thwarting U.S. goals with respect to the exiled Taliban and al-Qaeda figures.
or does it just want to control the country?
Like many military forces in developing countries, the Pakistani military sees itself as a protector of a certain vision of the Pakistani nation. It doesn't really want to run the country. Military forces aren't well suited for the administration of the ordinary non-military affairs of a national government. But it also feels a right and obligation to take "corrective action" if the civilian government departs too far from that vision.
Some of the corrective action is to address perceptions of corruption, incompetence, or a constitutional crisis, and some of it is to address gross deviations from a particular policy based vision of what the civilian government should look like.
If we take the Pakistan military's dependence on the USA to be the
real factor, can this be resolved by switching to
Russian/Chinese/Turkish arms? Why or why not?
Switching from U.S. and/or NATO standard arms to arms produced by another country is a non-trivial and expensive task, but it is also hardly impossible and many countries have purchased military equipment from both U.S. and non-U.S. vendors in the past (e.g. Egypt, many armies in Latin America, and many ex-Soviet independent republics). The natural way to switch is to replace old military equipment from one country that is obsolete or no longer serviceable with new equipment replacing it from some other country, over many years in the regular routine procurement process over time.
Jet fighters costs tens of millions of U.S. dollars to buy, thousands of U.S. dollars per hour of operation to maintain and operate, and scarce pilots whose training is moderately specific to specific models of aircraft. It would take many months of expensive training from outside pilots familiar with the new jet fighters for a pilot trained on one kind of jet fighter to learn to use another kind of jet fighter. Most pilots only learn to use one kind of jet fighter in their entire career.
The weapons carried by jet fighters are likewise not interchangeable between models. You can't just strap an air to air missile from an F-16 onto a Mirage or a JF-17 without incurring research and development costs and upgrade costs comparable to a new version of a jet fighter (e.g. an F-16A to an F-16B), if not more, and the development process to do that would run at least one to three years. (But in extreme circumstances, such as the Ukraine War, jerry rigged interim solutions can be found to, for example, allow a Russian jet fighter to fire a U.S. missile).
Similarly, you can't use NATO standard ammunition in non-NATO small arms or artillery units. They aren't quite the right size for each other. And, to train ground troops to use a different kind of small arms or a different howitzer unit, for example, would involve one to three months or so of training and require the soldiers being trained to have the new equipment in hand available to them to work with. Generally speaking, small arms, howitzers, and tanks, etc. are much easier to transition than military aircraft. In a pinch, as the Ukraine War illustrates, troops can get up to speed well enough to function with unfamiliar equipment very quickly, if it is a matter of life or death to them.
Also, in the transition period, a country with legacy U.S. military equipment is susceptible to having their supplies of ammunition and spare parts for that equipment cut off, although local substitutes can be crafted with enough lead time and at greater expense. But, since the U.S. uses NATO standard ammunition, any NATO member can supply it.
This said, characterizing the Pakistani Army as in a state of "military dependence" on the U.S. grossly overstates the situation. The Pakistani Army does not simply do what it is told by the U.S. It may assess U.S. government views as it contemplates taking political action for its own reasons, but the U.S. government is far from pulling the strings of who is in control in Pakistan's civilian government through the enforcer of the Pakistani Army, driven by its reliance on the U.S. for military equipment, as the question suggests.
The U.S. has nothing great to gain from instability in Pakistan's civilian leadership and from periodic coups or threatened coups. For the most part, Pakistan's governance isn't something it thinks about much unless it is worried about a nuclear war between India and Pakistan due to tensions in some political crisis that has gotten out of control.