Connecting Loss Based on Output of Other Function

This is a general AI question that I wanted to see if it has been addressed at any point.

Suppose we have some function A that has variables: x, y and z. Then we have a separate ML model B that takes as inputs the previous x, y, z and loss of function A, and then gives as output factors a, b, and c(i.e. 1.001, 0.998, 1.004) to multiply by x, y and z, with the goal of lowering the loss of function A. That new modified x, y and z then being inserted into function A to then get the new loss of function A.

Questions:

  1. How would you connect the new loss of function A to determine the loss of model B?
  2. Would it be possible to just simply insert/replace the new loss of function A as the loss of model B? How would that be done?