Had this same experience back when I first learned to program a PIC microcontroller. You really shouldn't be driving LEDs directly off IO pins anyways. I think the digitalness of IO pins also lends itself to not thinking about the underlying circuitry and coming at it from a software lens.
It depends. Many modern microcontrollers are perfectly fine driving LEDs directly off IO pins if the pin specs say it is rated for sufficient current (like 20mA). However, older ones like ESP8266 can only do like 2mA and the 8051 even less. Or you run into a total power budget issue if your are running too many pins. Also, some IO pins are perfectly fine at sinking current to ground but aren't suited for sourcing current, in which case the LED would be directly connected to an external high voltage and the IO pin would simply be switching to ground or not.