About dbt running specific models by path

The above states we can run only a subset of models via
dbt run --models path/to/models

Let us take a use case where we have a file path/to/models/a.sql such that there is a ref function in it that references the output of path/to/models_new/b.sql.

b.sql is situated anywhere outside the folder path/to/models

In such a situation will b.sql execute too when dbt run --models path/to/models runs?
Because intuitively it should run as we expect the latest data from the mentioned dependencies (through ref).

No, b.sql wouldn’t run because it’s not one of the selected nodes.

Take a look at the Graph operators sub-subsection of that doc. If you want model b to run (as well as all other models that are upstream of the models in the path/to/models folder), then you should call dbt run --models +path/to/models.