Suppose $Z$ is correlated with predictor $X$ and it is unobserved. One classical way of determining the coefficient $\beta_1$ in $Y = \beta_0 + \beta_1 X + \epsilon$ is finding an instrumental variable $U$.
However, doing so require one to first identify which are endogenous and which are exogenous variable. To that end, I wonder if there is any data driven method to help us figure which are endogenous or exogenous variable, and then estimate the coefficient $\beta_1$.
Causal Discovery
The keyword you may be looking for is "Causal Discovery", also known as "causal structure learning". Causal Discovery aims to infer causal structure from data, which would allow you to determine which variables are confounders, colliders, suitable instruments, and so on.
Many algorithms to this end depend on conditional independence testing, including the well-known PC algorithm (see e.g. this Review of Causal Discovery Methods Based on Graphical Models for an overview). Other algorithms make additional assumptions. For an overview of causal discovery methodologies in additive noise models (such as the one you give as an example), have a look at Section 4 of the Elements of Causal Inference.