Why aren't pins on microcontroller grouped together, close to each other?
In RAM chips, you often want all address/data lines to have the same length (the shorter the better), so that the signals travel along simultaneously and the clock frequency could be higher. Address and Data lines have to cover the entire area of the chip, so they are grouped by the physical location of the storage cells they feed, not by logical function.

Heterogeneous devices like micro-controllers have different kind of constraints. Some signals could interfere with each other (like a clock and a sensitive ADC) and cannot go to adjacent pins. Furthermore, distributing similar pins of both sides of the chip can actually improve routing of the PCB. Chances are, the chip will sit in the middle and have to talk to neighbors on both sides. Having all similar pins on one side would make PCB routing a nightmare.