Unlike football, the MVP in baseball doesn't have to be on a winning team. For the NFL, it's hard to win the MVP if your team isn't in the playoffs. Not in baseball--for example, Ohtani and Trout with the Angels.
And yes, it should be taken into consideration that Judge has more protection in the lineup than Cal does.
Hitting is by far the most important factor in the MVP voting, but voters are actually instructed that they must consider the player's defensive contributions as well as his hitting. In addition, the award is for the player who is most valuable "to his team":
“There is no clear-cut definition of what Most Valuable means. It is up to the individual voter to decide who was the Most Valuable Player in each league to his team. The MVP need not come from a division winner or other playoff qualifier.
“The rules of the voting remain the same as they were written on the first ballot in 1931: (1) actual value of a player to his team, that is, strength of offense and defense; (2) number of games played; (3) general character, disposition, loyalty and effort; (4) former winners are eligible; and (5) members of the committee may vote for more than one member of a team.”