You describe two reasonably long sequences $(X_i)$ and $(Y_i)$ of binary values and, with due caution, do not assume independence. Let's parse the possible meanings of that.
Uncorrelated sequences
First, if the $(X_i)$ are independent and the $(Y_i)$ are independent (and therefore uncorrelated), your problem comes down to assessing the sequence of independent variables $(X_i,Y_i).$ These variables have four possible values $(0,0),$ $(0,1),$ $(1,0),$ and $(1,1).$ The $2\times 2$ contingency table summarizes all the relevant information (it is a sufficient statistic for the data):
$$\begin{array}{l|cc|l} & Y=0 & Y=1 & \text{Total}\\
\hline X=0 & n_{00} & n_{01} & n_{0\cdot}\\
X=1 & n_{10} & n_{11} & n_{1\cdot}\\
\hline
\text{Total} & n_{\cdot 0} & n_{\cdot 1} & n
\end{array}$$
The cell values $n_{ij}$ count how many of the pairs equal $(i,j).$
If you don't make any assumptions about the rate at which each variable will produce $1$s, you can estimate that rate from the counts. The estimated rate for $X$ is $\hat p_X=n_{1\cdot}/n$ and the estimated rate for $Y$ is $\hat p_Y=n_{\cdot 1}/n.$ Otherwise, let $p_X$ be your assumed (or stipulated) rate for $X$ and $p_Y$ your rate for $Y.$ The analysis of the table is the same whether you put hats on $p_X$ and $p_Y$ or not.
If $X$ and $Y$ are independent (your null hypothesis), the rate in each cell ought to be the product of the corresponding rates times the total $n.$ Writing $\hat q_x = 1-\hat p_X$ and $\hat q_Y = 1-\hat p_Y$ for the rates of zeros gives the expected values $e_{ij},$
$$\begin{array}{l|cc|l} & Y=0 & Y=1 & \text{Total}\\
\hline X=0 & n \hat q_X \hat q_Y & n \hat q_X \hat p_Y & n \hat q_X\\
X=1 & n \hat p_X \hat q_Y & n \hat p_X \hat p_Y & n \hat p_X\\
\hline
\text{Total} & n \hat q_Y & n \hat p_Y & n
\end{array}$$
Given $n$ and your estimates $\hat p_X$ and $\hat p_Y,$ this table is determined by any single value in its cells. This leads to zillions of mathematically equivalent statistics you can use to express how much the data contingency table differs from this table of expectations: the odds ratio; the $\phi$ coefficient (which can range from $-1$ to $1$ and thereby satisfy your request for a "correlation"); Cramér's $V$; the contingency coefficient $C$; the tetrachoric correlation coefficient; asymmetric and symmetric $\lambda$ coefficients (also suitable as unsigned correlations); Theil's $U$ (another candidate for correlation); Cohen's $\kappa$; various formulas in terms of "true" and "false" "positives" and "negatives;" etc., etc.
One of the most useful statistics, though, is the $\chi^2$ (Chi-square) statistic. It is obtained from the residuals $n_{ij} - e_{ij}:$ you square each residual, divide that result by the expectation $e_{ij},$ and sum the values:
$$\chi^2 = \sum_{i=0}^1 \sum_{j=0}^1 \frac{\left(n_{ij} - e_{ij}\right)^2}{e_{ij}}.$$
When the $X$ and $Y$ sequences are independent, this value should be around $1$ (when you estimate the rates) with a standard deviation of $\sqrt 2;$ or around $3$ with a standard deviation of $\sqrt 6$ when you don't estimate the rates. Provided all four expected values are sufficiently large (usually $5$ is good enough), $\chi^2$ closely follows the chi-squared distribution with $1$ (or $3$) degrees of freedom. Large values of $\chi^2$ evidently indicate there are one or more large discrepancies between observed and expected frequencies and thereby provide evidence against the independence hypothesis. The chi-squared distribution can be used to produce p-values.
Correlated sequences
This is trickier. Intuitively, when one (or both) of the sequences $X$ and $Y$ is not independent, that will manifest in serial correlation. With positive serial correlation, a value tends to persist for a while before the other value appears. The patterns in the first example of the question exhibit this tendency at the end where long runs of ones appear. These runs can accidentally produce greater discrepancies (larger chi-squared statistics) than one might otherwise suppose.
To show that this matters, I generated two such sequences of length $n=2048$ many times. In the first case, each value was followed by the same value with a probability of $\rho = 0.05.$ These sequences tend to alternate zeros and ones. I did this again with $\rho = 0.5$ (random sequences) and $\rho=0.95$ (strong positive serial correlation). These histograms summarize the values of the resulting chi-squared statistics.

The middle panel, for the uncorrelated case, gives exactly what we would expect: the histogram closely approximates the $\chi^2(1)$ distribution plotted by the red curve. The other panels show how the statistics tend to be hugely greater than expected (the values are shown on a log scale, after all).
One way to cope with this is a "circular bootstrap." Basically, we rotate the arrays relative to each other, thereby matching $X_i$ with $Y_{i+h \mod n}$ when rotating by a lag of $h.$ This is a way of breaking the association between $X$ and $Y$ (via the rotation) without destroying the correlations internal to $X$ and $Y.$ The collection of all resulting chi-squared statistics (omitting, perhaps, small values of $h,$ which might not completely eliminate the effects of serial correlation) gives us a sense of what their values ought to be when there is no association between $X$ and $Y.$ This is theoretically justified for sufficiently long sequences.
The next figure shows the results of bootstrapping two binary $(X,Y)$ datasets of length 2048.) At the left, $X$ and $Y$ were independently generated with high serial correlation ($\rho=0.95$). This is the bootstrap distribution under the null hypothesis $H_0.$ At the right, $X$ was slightly modified by forcing it to agree with $Y$ with a chance of $10\%$ at each position. This randomly changed it at $120$ out of the $2048$ positions, creating a statistical dependence between $X$ and $Y$ corresponding to an alternate hypothesis $H_A.$

The p-values are given by the proportion of bootstrap results with larger (more discrepant) chi-squared values. The independent data have (in this example) a p-value of $0.91,$ not at all statistically significant. The dependent data have a p-value of $0.048,$ which many would consider significant.
This example thereby demonstrates that this chi-squared "circular bootstrap" can be effective at assessing and testing the independence of binary sequences $X$ and $Y$ especially when each sequence might be serially correlated.
This bootstrapping is easier than it might look. Here, for example, is the R
code used to produce the previous figure. The omit
argument is the minimum number of lags $h$ to leave off at both ends of the rotation. It will thereby output n - 2*omit
bootstrap statistics.
chisq.boot <- function(x, y, omit=0, stat=chisq.binary) {
h <- seq_along(y)[seq(omit+1, length(y)-omit)]
sapply(h, function(i) {stat(c(x[-seq_len(i)], x[seq_len(i)]), y)})
}
It refers to a function stat
to compute the statistic you are using to compare $X$ to $Y.$ The function used here by default is the chi-squared statistic explained in the first half of this post.
chisq.binary <- function(x, y) {
n <- tabulate(x + 2*y + 1, 4)
n.x <- n[2] + n[4]
n.y <- n[3] + n[4]
n.. <- sum(n)
e <- c(outer(c(n.. - n.x, n.x), c(n.. - n.y, n.y))) / n..
sum((n - e)^2 / e)
}