Can the President prevent Amendment 25 removal from office by firing the Cabinet?
No, by law, firing cabinet appointees would result in an assistant becoming the acting head for that cabinet position, unless the president appointed another person to that role. When a Civil Service employee is the assistant, that person cannot be fired by the president. Firing all appointed cabinet members would result in leaving some acting heads of departments that can act under the 25th amendment.
Every "Executive agency" has a "first assistant" who becomes the acting head of that agency.
5 U.S. Code § 3345 - Acting officer
(a) If an officer of an Executive agency (including the Executive Office of the President, and other than the Government Accountability Office) whose appointment to office is required to be made by the President, by and with the advice and consent of the Senate, dies, resigns, or is otherwise unable to perform the functions and duties of the office—
(1) the first assistant to the office of such officer shall perform the functions and duties of the office temporarily in an acting capacity subject to the time limitations of section 3346;
[. . .]
"Executive agency" includes "Executive department".
5 U.S. Code § 105. Executive agency
For the purpose of this title, “Executive agency” means an Executive department, a Government corporation, and an independent establishment.
The "Executive departments" taken together is the cabinet.
5 U.S. Code § 101. Executive departments
The Executive departments are:
The Department of State.
The Department of the Treasury.
The Department of Defense.
The Department of Justice.
The Department of the Interior.
The Department of Agriculture.
The Department of Commerce.
The Department of Labor.
The Department of Health and Human Services.
The Department of Housing and Urban Development.
The Department of Transportation.
The Department of Energy.
The Department of Education.
The Department of Veterans Affairs.
The Department of Homeland Security.
As shown in the answer at If the VP were to invoke the 25th amendment to remove the President as unfit for office, would acting secretaries be able to consent?, "the acting head would be authorized to participate in a presidential disability determination."