I don't think either issue is above one or another. Its problematic to build such databases, and it is problematic that the government is buying these services despite being forbidden from doing it themselves. Being able to buy it is a huge loophole and they all know it is a loophole and is breaking the spirit of the law.
Its like saying murder is illegal but hiring a hitman perfectly legal. Its bullshit and everyone involved in these decisions should be in jail. There is no way anybody working for the FBI can claim ignorance to the constitution.