It's probably simpler than that: it's simply not energy-efficient to keep producing an enzyme throughout its life for a sugar that's rare-to-non-existent in an organism's diet for most of that life. Because mammals don't have any means of obtaining milk once they separate from their mother, lactose intolerance for their lifetime after weaning is almost universal among mammals. Over millions of years, the slight energy efficiency win of turning off that enzyme's production post-weaning probably won out.
Humans are odd in that we harvest milk for consumption at all beyond our own mother's, which is probably why we're the only species with a notable population with the genetic mutation that allows some of us to digest it – there's no competitive advantage to that mutation in most other mammals, because where would they even obtain milk?
The specific enzyme that breaks lactose is lactase. It's built from almost 2000 amino acids. In comparison, Alpha-Amylase, the enzyme that breaks starch, is much smaller. Couldn't find an exact count but it appears in the ballpark of 200.
It seems that lactose tolerance is the new thing here.
Lactose intolerance is normal, but for a few people, presumably dairy animal farmers, something happened to their genes and they became tolerant, and it was an evolutionary avantage because they had access to all that milk. But because access to farmed milk is relatively recent from an evolutionary standpoint and people can live with lactose intolerance, the trait hasn't spread to all of humanity.
Or people who worked out they were tolerant to it, farmed it, and the high density nutrients allowed faster more reliable development of healthy children in adverse conditions. i.e. North Western Europe.
Also a possible reason for why people have different taste preferences.