The issue turned out to be quite strange. On Windows, "kubectl edit" basically runs the command "notepad" in cmd behind the scenes, if some environment variables are not set otherwise: https://kubernetes.io/docs/reference/kubectl/generated/kubectl_edit/
When I tried running "notepad" in cmd, I encountered errors saying, "This program can't run on Windows" and "Access is denied." However, I could still open Notepad through PowerShell or other methods. Running "where notepad" in cmd revealed multiple locations for the executable, with the top one being "C:\Users\myuser\notepad.exe" Upon checking, I found a zero-byte notepad.exe file there, though I have no idea how it got created. Deleting that file resolved the issue, and kubectl started working normally again.