The scope of the various cabinet agencies and their organization is proscribed by laws passed in congress, i.e. the legislative branch.
The commerce secretary is not a bureaucrat, he is an appointee and agent of the president, acts at his direction, and is therefore part of the executive branch. When a cabinet member makes decisions regarding how the law is to be interpreted, it is legally the same as the president doing so. You are incorrect in saying he is an unelected bureaucrat.
The law clearly states the commerce secretary can tailor the census as he sees fit. The plaintiffs in this action claim the opinions of staff are binding on the secretary.
That is the constitutional question. You're correct in saying the courts, or the judicial branch, determine which of the two above positions follow the law. That's why it is before the Supreme Court.
Again, this is not a political post. When I say "president", it refers to the person that has been legally elected to execute the law, not the current occupant of the White House.