[TECHNICAL-SUPPORT] LPS-48480 Previously dynamically loaded pages don't preserve their state within the same user session in Site Pages

https://issues.liferay.com/browse/LPS-48480
https://issues.liferay.com/browse/LPS-48983 (closed as reorganized, Zsaga's (aka. Zsolt Szabó) solution for that LPS has been merged into this pull)

Hey Eduardo,

I'm forwarding this pull to you, since you know well the LayoutsTreeUtil and the related staffs for layouts tree.

Originally, Zsaga sent to me 2 different pulls
https://github.com/lipusz/liferay-portal/pull/36 --> LPS-48480
https://github.com/lipusz/liferay-portal/pull/37 --> LPS-48983

but during the review it turned out to me that we need the changes of both pulls in the same time to get it work for all levels of the tree. Thus, I decided to merge them into one.

I tested the solution for different use cases (with and without staging) and worked well.
Though, I experienced a problem when the property

```properties
	javascript.single.page.application.enabled=true
```
was set:

clicking on the "Site Pages" link in the Control Panel did not issue any request from the browser, instead, it loaded the previous content from cache. So, if you navigate to Site Pages, open some nodes that were collapsed previously, and click on "Site Pages" again, you will get them as collapsed again.

"Save" button and page refresh work fine.
Cannot be reproduced when SPA is disabled.

Let me know if you have any questions.

Regards,
Tibor

/cc @zsagia