I have been programming on macOS since 1992. I read a lot of similar questions
just some ideas:
if you want to learn to ride an horse, You need and horse...
put simply APPLE does not want you use a "non-controlled" OS / hardware, they fear someone can hack their ecosystem
even if feasible, a decent Mac just to start, can cost 1K $, similar to a decent PC.
A 300 $ PC is simply unusable even if house Visual studio / eclipse or other ide.
I can barely accept this kind of question in 90's years when a Mac price was from 5 to 10 times a PC, not now.