a neural network can be used as an optimizer?
Theoretically yes, pratically no.
just think About what you Need for this second Network. You Need a dataset X of real numbers representing loss and you Need y representing weight plus bias.
You can already see that weights of a slightly different Architecture will be different. So creating such dataset is just infeasable given that you Need a lot of datapoints for your Network to learn.