Dealing with data where the values of variable Y depend on values of variable X

Hi there, I've been doing some undergrad research and am confused about how to handle some of my data (and my professor doesn't know much about stats...:( )

Basically, I'm looking at the durations of two behaviours in animals, behaviour X and behaviour Y. Behaviour Y occurs while the animal is already engaged in behaviour X, so, to some extent, the value of behaviour Y is limited by the value of behaviour X.

For example, if behaviour X is only 3 seconds long, then behaviour Y must be 3 seconds or less. If behaviour X is 25 seconds long, then behaviour Y must be 25 seconds or less.

I wanted to look at the relationship between behaviours X and Y, as I've predicted that as the duration of behaviour X increases, so too does the duration of behaviour Y occurring within.

I'm quite confused on how to handle this. I'm wondering if this somehow violates the assumption of independent observations? Am I even allowed to do a linear regression, pearson correlation, or a spearman rank test on this data?

Beyond this, my problem is that due to the nature of the data, I have issues with increasing variance that aren't really solved by log or square-root transformations. I do have a glm that describes other variables that affect the duration of behaviour Y. Can I just chuck it into the model and leave it there as long as the assumptions for the glm still end up being met in the end?

Here is an example of what my data look like without a transformation:

And here when they are log-transformed:

Really hope someone can help me! Thanks for reading!