Portlets embedded in layouts don't get their preferences assigned dynamically based on the script in the layout's TPL file every time a page is requested (as was the case in 6.2). Instead, the preferences are ALWAYS persisted in the DB and once that happens, the preferences from the layout become ineffective (every page using the layout looks exactly the same even if the script customizes the page depending on the context (eg. $layout.getExpandoBridge().getAttribute("categoryId")).
This behawior was introduced via
LPS-62334 in the 7.x by the adding the additional parameter in the doTag method invocation from within the doTag(String portletName, String instanceId, String queryString, String defaultPreferences, PageContext pageContext, HttpServletRequest request, HttpServletResponse response) method of [util-taglib/src/com/liferay/taglib/portletext/RuntimeTag.java|https://github.com/liferay/liferay-portal/commit/8028385460e6f387461a959d7cd66b3b29643cfc#diff-2ce244f86d860314765a05e1a6eacde9] (line 14) (marked in red below):
portletName, instanceId, queryString, _SETTINGS_SCOPE_DEFAULT,
defaultPreferences, pageContext, request, response);
defaultPreferences, true, pageContext, request, response);