Maybe a better question is why have we let so much farmland get repurposed for other, arguably trivial uses?
Easy, money and risk. Building a high-rise building with 200 units takes about as much land as two or three single-family homes. But it is much riskier to build the high-rise; it costs more, and all 200 units might not sell. So it's easier to just build the single-family homes; now you only have two things to sell instead of 200. Very inefficient use of space, but efficient use of space is not rewarded in any way. The fact that there is no longer any place to grow crops is Someone Else's Problem. You have money to make!
Easy, money and risk. Building a high-rise building with 200 units takes about as much land as two or three single-family homes. But it is much riskier to build the high-rise; it costs more, and all 200 units might not sell. So it's easier to just build the single-family homes; now you only have two things to sell instead of 200. Very inefficient use of space, but efficient use of space is not rewarded in any way. The fact that there is no longer any place to grow crops is Someone Else's Problem. You have money to make!